@csmart/ngc-smart-core 1.14.7 → 1.14.10

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 (46) hide show
  1. package/README.md +24 -24
  2. package/esm2020/csmart-ngc-smart-core.mjs +4 -4
  3. package/esm2020/lib/ngc-smart-core.module.mjs +95 -95
  4. package/esm2020/lib/smart-auth/smart-access-control-config.mjs +12 -12
  5. package/esm2020/lib/smart-auth/smart-access-control.directive.mjs +39 -39
  6. package/esm2020/lib/smart-auth/smart-auth.service.mjs +504 -504
  7. package/esm2020/lib/smart-auth/smart-authorization-guard.service.mjs +35 -35
  8. package/esm2020/lib/smart-auth/smart-error.component.mjs +37 -37
  9. package/esm2020/lib/smart-auth/smart-login-staff-resolver.service.mjs +59 -59
  10. package/esm2020/lib/smart-auth/smart-selected-offender-resolver.service.mjs +49 -49
  11. package/esm2020/lib/smart-navbar/smart-navbar-config.mjs +2 -2
  12. package/esm2020/lib/smart-navbar/smart-navbar.component.mjs +167 -167
  13. package/esm2020/lib/smart-navbar/smart-navbar.service.mjs +63 -63
  14. package/esm2020/lib/smart-offender-header/smart-offender-header.component.mjs +151 -151
  15. package/esm2020/lib/smart-offender-header/smart-offender-header.service.mjs +41 -41
  16. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.mjs +25 -25
  17. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options.component.mjs +78 -78
  18. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options.service.mjs +132 -132
  19. package/esm2020/lib/smart-storage/smart-storage-model.mjs +30 -30
  20. package/esm2020/lib/smart-storage/xdm.service.mjs +171 -171
  21. package/esm2020/public-api.mjs +20 -20
  22. package/fesm2015/csmart-ngc-smart-core.mjs +1527 -1527
  23. package/fesm2015/csmart-ngc-smart-core.mjs.map +1 -1
  24. package/fesm2020/csmart-ngc-smart-core.mjs +1513 -1513
  25. package/fesm2020/csmart-ngc-smart-core.mjs.map +1 -1
  26. package/index.d.ts +5 -5
  27. package/lib/ngc-smart-core.module.d.ts +20 -20
  28. package/lib/smart-auth/smart-access-control-config.d.ts +17 -17
  29. package/lib/smart-auth/smart-access-control.directive.d.ts +14 -14
  30. package/lib/smart-auth/smart-auth.service.d.ts +41 -41
  31. package/lib/smart-auth/smart-authorization-guard.service.d.ts +13 -13
  32. package/lib/smart-auth/smart-error.component.d.ts +17 -17
  33. package/lib/smart-auth/smart-login-staff-resolver.service.d.ts +13 -13
  34. package/lib/smart-auth/smart-selected-offender-resolver.service.d.ts +15 -15
  35. package/lib/smart-navbar/smart-navbar-config.d.ts +7 -7
  36. package/lib/smart-navbar/smart-navbar.component.d.ts +40 -40
  37. package/lib/smart-navbar/smart-navbar.service.d.ts +12 -12
  38. package/lib/smart-offender-header/smart-offender-header.component.d.ts +32 -32
  39. package/lib/smart-offender-header/smart-offender-header.service.d.ts +18 -18
  40. package/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.d.ts +11 -11
  41. package/lib/smart-staff-offender-options/smart-staff-offender-options.component.d.ts +22 -22
  42. package/lib/smart-staff-offender-options/smart-staff-offender-options.service.d.ts +19 -19
  43. package/lib/smart-storage/smart-storage-model.d.ts +58 -58
  44. package/lib/smart-storage/xdm.service.d.ts +42 -42
  45. package/package.json +1 -1
  46. package/public-api.d.ts +16 -16
@@ -27,1555 +27,1555 @@ import * as i2$1 from '@angular/router';
27
27
  import * as i6 from '@angular/material/form-field';
28
28
  import * as i8 from '@angular/material/core';
29
29
 
30
- class Permission {
31
- }
32
- class Role {
33
- }
34
- class Option {
35
- }
36
- class LoginStaff {
37
- constructor() {
38
- this.selectedRole = '*';
39
- }
40
- }
41
- class SelectedOffender {
42
- constructor() {
43
- this.intakeFlag = false;
44
- }
45
- }
46
- class OffenderQuery {
47
- }
48
- class StorageKey {
49
- }
50
- StorageKey.selectedOffender = 'smart-selected-offender';
51
- StorageKey.loginStaff = 'smart-login-staff';
52
- StorageKey.offenderQuery = 'smart-offender-query';
53
- const SMART_WEB_STORAGE_LISTENER_URL = new InjectionToken('SMART Web Storage Listener URL');
54
- const SMART_WEB_PORTAL_URL = new InjectionToken('SMART Web Portal URL');
55
- const SMART_DATA_SERVICE_URL = new InjectionToken('SMART Data Service URL');
56
- //exception for redirection
30
+ class Permission {
31
+ }
32
+ class Role {
33
+ }
34
+ class Option {
35
+ }
36
+ class LoginStaff {
37
+ constructor() {
38
+ this.selectedRole = '*';
39
+ }
40
+ }
41
+ class SelectedOffender {
42
+ constructor() {
43
+ this.intakeFlag = false;
44
+ }
45
+ }
46
+ class OffenderQuery {
47
+ }
48
+ class StorageKey {
49
+ }
50
+ StorageKey.selectedOffender = 'smart-selected-offender';
51
+ StorageKey.loginStaff = 'smart-login-staff';
52
+ StorageKey.offenderQuery = 'smart-offender-query';
53
+ const SMART_WEB_STORAGE_LISTENER_URL = new InjectionToken('SMART Web Storage Listener URL');
54
+ const SMART_WEB_PORTAL_URL = new InjectionToken('SMART Web Portal URL');
55
+ const SMART_DATA_SERVICE_URL = new InjectionToken('SMART Data Service URL');
56
+ //exception for redirection
57
57
  const SMART_DOMAIN_FORMAT = new InjectionToken('SMART Domain Format URL');
58
58
 
59
- class XdmService {
60
- constructor(document, smartStorageListenerUrl, httpClient, smartDataServiceUrl) {
61
- this.document = document;
62
- this.smartStorageListenerUrl = smartStorageListenerUrl;
63
- this.httpClient = httpClient;
64
- this.smartDataServiceUrl = smartDataServiceUrl;
65
- this.offenderSubject = new Subject();
66
- this.staffSubject = new Subject();
67
- this.offenderQuerySubject = new Subject();
68
- if (isDevMode) {
69
- console.log('SmartStorage XdmService (Client) - constructor()');
70
- }
71
- this.init();
72
- }
73
- init() {
74
- const frame = this.document.createElement('iframe');
75
- frame.src = this.smartStorageListenerUrl;
76
- frame.id = 'childframe';
77
- frame.name = Math.random().toString();
78
- frame.onload = null;
79
- frame.style.visibility = 'hidden';
80
- this.document.body.appendChild(frame);
81
- this.connection = connectToChild({
82
- iframe: frame,
83
- debug: false,
84
- });
85
- }
86
- getStaffOffenderListOptions(staffId) {
87
- const queryString = `{findvStaffOffenderListOptions(input:{
88
- where:{
89
- staffId: ${staffId}
90
- }
91
- }){
92
- data{
93
- offenderListOptionId
94
- name
95
- serviceApiFieldName
96
- selectedFlag
97
- }
98
- } }`;
99
- return this.httpClient
100
- .post(this.smartDataServiceUrl, { query: queryString })
101
- .pipe(map(({ data }) => {
102
- data.findvStaffOffenderListOptions.data['offenderOptionListId'] =
103
- data.findvStaffOffenderListOptions.data['offenderListOptionId'];
104
- return data.findvStaffOffenderListOptions.data;
105
- }));
106
- /*return of([
107
- { offenderListOptionId: 'genderCode', name: '', selectedFlag: true }]);*/
108
- }
109
- clearAll() {
110
- this.connection.promise.then((child) => {
111
- child.clearAll();
112
- this.offenderSubject.next();
113
- this.staffSubject.next();
114
- });
115
- }
116
- /*************************************
117
- * Offender
118
- **************************************/
119
- setSelectedOffender(selectedOffender) {
120
- this.connection.promise.then((child) => {
121
- child.setSelectedOffender(selectedOffender);
122
- this.offenderSubject.next(selectedOffender);
123
- });
124
- this.getLoginStaff().then((loginStaff) => {
125
- let now = (new Date()).toISOString();
126
- const queryString = `mutation { createStaffOffenderAccess(input: {
127
- staffId: ${loginStaff.staffId},
128
- offenderId: ${selectedOffender.offenderId},
129
- accessDate: ${now}
130
- }) {
131
- data {
132
- staffOffenderAccessId
133
- }
134
- }}`;
135
- this.httpClient.post(this.smartDataServiceUrl, { query: queryString }).subscribe();
136
- });
137
- }
138
- getSelectedOffender() {
139
- return this.connection.promise.then((child) => child.getSelectedOffender(StorageKey.selectedOffender));
140
- }
141
- clearSelectedOffender() {
142
- this.connection.promise.then((child) => {
143
- child.clearSelectedOffender();
144
- this.offenderSubject.next();
145
- });
146
- }
147
- getOffenderUpdate() {
148
- return this.offenderSubject.asObservable();
149
- }
150
- /************************************************************************
151
- * Staff
152
- ************************************************************************/
153
- setLoginStaff(loginStaff) {
154
- this.connection.promise.then((child) => {
155
- child.setLoginStaff(loginStaff);
156
- this.staffSubject.next(loginStaff);
157
- });
158
- }
159
- getLoginStaff() {
160
- return this.connection.promise.then((child) => child.getLoginStaff(StorageKey.loginStaff));
161
- }
162
- clearLoginStaff() {
163
- this.connection.promise.then((child) => {
164
- child.clearLoginStaff();
165
- this.staffSubject.next();
166
- });
167
- }
168
- getStaffUpdate() {
169
- return this.staffSubject.asObservable();
170
- }
171
- refreshLoginStaffOptions() {
172
- this.getLoginStaff().then((oldLoginStaff) => {
173
- this.getStaffOffenderListOptions(oldLoginStaff.staffId).subscribe((optionData) => {
174
- console.log(optionData);
175
- oldLoginStaff.options = optionData;
176
- this.setLoginStaff(oldLoginStaff);
177
- });
178
- });
179
- }
180
- /************************************************************************
181
- * Offender Query
182
- ************************************************************************/
183
- setOffenderQuery(offenderQuery) {
184
- this.connection.promise.then((child) => {
185
- child.setOffenderQuery(offenderQuery);
186
- this.offenderQuerySubject.next(offenderQuery);
187
- });
188
- }
189
- getOffenderQuery() {
190
- return this.connection.promise.then((child) => child.getOffenderQuery(StorageKey.offenderQuery));
191
- }
192
- clearOffenderQuery() {
193
- this.connection.promise.then((child) => {
194
- child.clearOffenderQuery();
195
- this.offenderQuerySubject.next();
196
- });
197
- }
198
- getOffenderQueryUpdate() {
199
- return this.offenderQuerySubject.asObservable();
200
- }
201
- }
202
- /** @nocollapse */ XdmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, deps: [{ token: DOCUMENT }, { token: SMART_WEB_STORAGE_LISTENER_URL }, { token: i1.HttpClient }, { token: SMART_DATA_SERVICE_URL }], target: i0.ɵɵFactoryTarget.Injectable });
203
- /** @nocollapse */ XdmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, providedIn: 'root' });
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, decorators: [{
205
- type: Injectable,
206
- args: [{
207
- providedIn: 'root',
208
- }]
209
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
210
- type: Inject,
211
- args: [DOCUMENT]
212
- }] }, { type: undefined, decorators: [{
213
- type: Inject,
214
- args: [SMART_WEB_STORAGE_LISTENER_URL]
215
- }] }, { type: i1.HttpClient }, { type: undefined, decorators: [{
216
- type: Inject,
217
- args: [SMART_DATA_SERVICE_URL]
59
+ class XdmService {
60
+ constructor(document, smartStorageListenerUrl, httpClient, smartDataServiceUrl) {
61
+ this.document = document;
62
+ this.smartStorageListenerUrl = smartStorageListenerUrl;
63
+ this.httpClient = httpClient;
64
+ this.smartDataServiceUrl = smartDataServiceUrl;
65
+ this.offenderSubject = new Subject();
66
+ this.staffSubject = new Subject();
67
+ this.offenderQuerySubject = new Subject();
68
+ if (isDevMode) {
69
+ console.log('SmartStorage XdmService (Client) - constructor()');
70
+ }
71
+ this.init();
72
+ }
73
+ init() {
74
+ const frame = this.document.createElement('iframe');
75
+ frame.src = this.smartStorageListenerUrl;
76
+ frame.id = 'childframe';
77
+ frame.name = Math.random().toString();
78
+ frame.onload = null;
79
+ frame.style.visibility = 'hidden';
80
+ this.document.body.appendChild(frame);
81
+ this.connection = connectToChild({
82
+ iframe: frame,
83
+ debug: false,
84
+ });
85
+ }
86
+ getStaffOffenderListOptions(staffId) {
87
+ const queryString = `{findvStaffOffenderListOptions(input:{
88
+ where:{
89
+ staffId: ${staffId}
90
+ }
91
+ }){
92
+ data{
93
+ offenderListOptionId
94
+ name
95
+ serviceApiFieldName
96
+ selectedFlag
97
+ }
98
+ } }`;
99
+ return this.httpClient
100
+ .post(this.smartDataServiceUrl, { query: queryString })
101
+ .pipe(map(({ data }) => {
102
+ data.findvStaffOffenderListOptions.data['offenderOptionListId'] =
103
+ data.findvStaffOffenderListOptions.data['offenderListOptionId'];
104
+ return data.findvStaffOffenderListOptions.data;
105
+ }));
106
+ /*return of([
107
+ { offenderListOptionId: 'genderCode', name: '', selectedFlag: true }]);*/
108
+ }
109
+ clearAll() {
110
+ this.connection.promise.then((child) => {
111
+ child.clearAll();
112
+ this.offenderSubject.next();
113
+ this.staffSubject.next();
114
+ });
115
+ }
116
+ /*************************************
117
+ * Offender
118
+ **************************************/
119
+ setSelectedOffender(selectedOffender) {
120
+ this.connection.promise.then((child) => {
121
+ child.setSelectedOffender(selectedOffender);
122
+ this.offenderSubject.next(selectedOffender);
123
+ });
124
+ this.getLoginStaff().then((loginStaff) => {
125
+ let now = (new Date()).toISOString();
126
+ const queryString = `mutation { createStaffOffenderAccess(input: {
127
+ staffId: ${loginStaff.staffId},
128
+ offenderId: ${selectedOffender.offenderId},
129
+ accessDate: "${now}"
130
+ }) {
131
+ data {
132
+ staffOffenderAccessId
133
+ }
134
+ }}`;
135
+ this.httpClient.post(this.smartDataServiceUrl, { query: queryString }).subscribe();
136
+ });
137
+ }
138
+ getSelectedOffender() {
139
+ return this.connection.promise.then((child) => child.getSelectedOffender(StorageKey.selectedOffender));
140
+ }
141
+ clearSelectedOffender() {
142
+ this.connection.promise.then((child) => {
143
+ child.clearSelectedOffender();
144
+ this.offenderSubject.next();
145
+ });
146
+ }
147
+ getOffenderUpdate() {
148
+ return this.offenderSubject.asObservable();
149
+ }
150
+ /************************************************************************
151
+ * Staff
152
+ ************************************************************************/
153
+ setLoginStaff(loginStaff) {
154
+ this.connection.promise.then((child) => {
155
+ child.setLoginStaff(loginStaff);
156
+ this.staffSubject.next(loginStaff);
157
+ });
158
+ }
159
+ getLoginStaff() {
160
+ return this.connection.promise.then((child) => child.getLoginStaff(StorageKey.loginStaff));
161
+ }
162
+ clearLoginStaff() {
163
+ this.connection.promise.then((child) => {
164
+ child.clearLoginStaff();
165
+ this.staffSubject.next();
166
+ });
167
+ }
168
+ getStaffUpdate() {
169
+ return this.staffSubject.asObservable();
170
+ }
171
+ refreshLoginStaffOptions() {
172
+ this.getLoginStaff().then((oldLoginStaff) => {
173
+ this.getStaffOffenderListOptions(oldLoginStaff.staffId).subscribe((optionData) => {
174
+ console.log(optionData);
175
+ oldLoginStaff.options = optionData;
176
+ this.setLoginStaff(oldLoginStaff);
177
+ });
178
+ });
179
+ }
180
+ /************************************************************************
181
+ * Offender Query
182
+ ************************************************************************/
183
+ setOffenderQuery(offenderQuery) {
184
+ this.connection.promise.then((child) => {
185
+ child.setOffenderQuery(offenderQuery);
186
+ this.offenderQuerySubject.next(offenderQuery);
187
+ });
188
+ }
189
+ getOffenderQuery() {
190
+ return this.connection.promise.then((child) => child.getOffenderQuery(StorageKey.offenderQuery));
191
+ }
192
+ clearOffenderQuery() {
193
+ this.connection.promise.then((child) => {
194
+ child.clearOffenderQuery();
195
+ this.offenderQuerySubject.next();
196
+ });
197
+ }
198
+ getOffenderQueryUpdate() {
199
+ return this.offenderQuerySubject.asObservable();
200
+ }
201
+ }
202
+ /** @nocollapse */ XdmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, deps: [{ token: DOCUMENT }, { token: SMART_WEB_STORAGE_LISTENER_URL }, { token: i1.HttpClient }, { token: SMART_DATA_SERVICE_URL }], target: i0.ɵɵFactoryTarget.Injectable });
203
+ /** @nocollapse */ XdmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, providedIn: 'root' });
204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: XdmService, decorators: [{
205
+ type: Injectable,
206
+ args: [{
207
+ providedIn: 'root',
208
+ }]
209
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
210
+ type: Inject,
211
+ args: [DOCUMENT]
212
+ }] }, { type: undefined, decorators: [{
213
+ type: Inject,
214
+ args: [SMART_WEB_STORAGE_LISTENER_URL]
215
+ }] }, { type: i1.HttpClient }, { type: undefined, decorators: [{
216
+ type: Inject,
217
+ args: [SMART_DATA_SERVICE_URL]
218
218
  }] }]; } });
219
219
 
220
- class SmartOffenderHeaderService {
221
- constructor(smartDataServiceUrl, http) {
222
- this.smartDataServiceUrl = smartDataServiceUrl;
223
- this.http = http;
224
- }
225
- getStaffOffenders(staffId) {
226
- const queryString = `
227
- query getStaffOffenderList{
228
- filterOffenderList(input: {staffId: ${staffId}}) {
229
- data {
230
- offenderId
231
- offenderName
232
- pdId
233
- birthDate
234
- gender
235
- }
236
- }
237
- }
238
- `;
239
- return this.http
240
- .post(this.smartDataServiceUrl, { query: queryString })
241
- .pipe(map(({ data }) => {
242
- return data.filterOffenderList.data;
243
- }));
244
- }
245
- }
246
- /** @nocollapse */ SmartOffenderHeaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService, deps: [{ token: SMART_DATA_SERVICE_URL }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
247
- /** @nocollapse */ SmartOffenderHeaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService });
248
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService, decorators: [{
249
- type: Injectable
250
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
251
- type: Inject,
252
- args: [SMART_DATA_SERVICE_URL]
220
+ class SmartOffenderHeaderService {
221
+ constructor(smartDataServiceUrl, http) {
222
+ this.smartDataServiceUrl = smartDataServiceUrl;
223
+ this.http = http;
224
+ }
225
+ getStaffOffenders(staffId) {
226
+ const queryString = `
227
+ query getStaffOffenderList{
228
+ filterOffenderList(input: {staffId: ${staffId}}) {
229
+ data {
230
+ offenderId
231
+ offenderName
232
+ pdId
233
+ birthDate
234
+ gender
235
+ }
236
+ }
237
+ }
238
+ `;
239
+ return this.http
240
+ .post(this.smartDataServiceUrl, { query: queryString })
241
+ .pipe(map(({ data }) => {
242
+ return data.filterOffenderList.data;
243
+ }));
244
+ }
245
+ }
246
+ /** @nocollapse */ SmartOffenderHeaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService, deps: [{ token: SMART_DATA_SERVICE_URL }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
247
+ /** @nocollapse */ SmartOffenderHeaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService });
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderService, decorators: [{
249
+ type: Injectable
250
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
251
+ type: Inject,
252
+ args: [SMART_DATA_SERVICE_URL]
253
253
  }] }, { type: i1.HttpClient }]; } });
254
254
 
255
- class SmartOffenderHeaderComponent {
256
- // public isAuthenticated: boolean;
257
- constructor(xdmService, authnService, smartOffenderHeaderService, router) {
258
- this.xdmService = xdmService;
259
- this.authnService = authnService;
260
- this.smartOffenderHeaderService = smartOffenderHeaderService;
261
- this.router = router;
262
- this.selectedOffenderControl$ = new UntypedFormControl();
263
- }
264
- ngOnInit() {
265
- // this.isAuthenticated = this.authnService.getAccount() ? true : false;
266
- this.xdmService.getLoginStaff().then((loginStaff) => {
267
- this.loginStaff = loginStaff ? loginStaff : null;
268
- });
269
- this.xdmService.getSelectedOffender().then((selectedOffender) => {
270
- this.selectedOffender =
271
- selectedOffender && selectedOffender.offenderId
272
- ? selectedOffender
273
- : null;
274
- });
275
- this.subscription = this.xdmService
276
- .getOffenderUpdate()
277
- .subscribe((selectedOffender) => {
278
- this.selectedOffender = selectedOffender;
279
- this.setSelectedOffenderControl();
280
- });
281
- this.xdmService.getOffenderQuery().then((offenderQuery) => {
282
- if (offenderQuery) {
283
- this.offenderQueryList = offenderQuery.offenders;
284
- this.setSelectedOffenderControl();
285
- }
286
- });
287
- this.offenderQuerySubscription = this.xdmService
288
- .getOffenderQueryUpdate()
289
- .subscribe((offenderList) => {
290
- if (offenderList && offenderList.offenders) {
291
- this.offenderQueryList = [...offenderList.offenders];
292
- }
293
- });
294
- this.selectedOffenderControl$.valueChanges.subscribe((o) => this.onOffenderSelected(o));
295
- this.router.routeReuseStrategy.shouldReuseRoute = () => {
296
- return false;
297
- };
298
- }
299
- get isAuthenticated() {
300
- return this.authnService.instance.getAllAccounts().length > 0;
301
- }
302
- ngOnDestroy() {
303
- this.subscription.unsubscribe();
304
- }
305
- onOffenderSelected(offender) {
306
- if (offender) {
307
- // const o = offender.offenderName.split(',');
308
- // if (o.length === 2) {
309
- // const offenderName = `${o[1]} ${o[0]}`;
310
- // this.selectedOffender = {
311
- // offenderId: offender.offenderId,
312
- // name: offenderName,
313
- // pdId: offender.pdId,
314
- // birthDate: offender.birthDate,
315
- // gender: offender.genderCode,
316
- // assignmentStaffRelationId: '',
317
- // intakeFlag: this.loginStaff
318
- // ? this.hasIntakeRole(this.loginStaff.roles)
319
- // : false,
320
- // } as SelectedOffender;
321
- this.selectedOffender = offender;
322
- this.xdmService.setSelectedOffender(this.selectedOffender);
323
- this.reloadCurrentRoute();
324
- }
325
- }
326
- setSelectedOffenderControl() {
327
- if (this.selectedOffender &&
328
- this.offenderQueryList &&
329
- this.offenderQueryList.length > 0) {
330
- const o = this.offenderQueryList.find((x) => x.offenderId === this.selectedOffender.offenderId);
331
- if (o) {
332
- this.selectedOffenderControl$.setValue(o, { emitEvent: false });
333
- }
334
- if (!o && this.offenderQueryList.length > 0) {
335
- this.selectedOffenderControl$.setValue(this.offenderQueryList[0], {
336
- emitEvent: false,
337
- });
338
- }
339
- }
340
- }
341
- reloadCurrentRoute() {
342
- try {
343
- const urlTree = this.router.parseUrl(this.router.url);
344
- if (urlTree &&
345
- urlTree.root &&
346
- urlTree.root.segments &&
347
- urlTree.root.segments.length > 1) {
348
- this.router.navigate([urlTree.root.segments[0].path]);
349
- }
350
- else if (urlTree &&
351
- urlTree.root &&
352
- urlTree.root.children &&
353
- urlTree.root.children.primary &&
354
- urlTree.root.children.primary.segments &&
355
- urlTree.root.children.primary.segments.length > 1) {
356
- this.router.navigate([urlTree.root.children.primary.segments[0].path]);
357
- }
358
- else {
359
- this.router.navigate([this.router.url]);
360
- }
361
- }
362
- catch {
363
- this.router.navigateByUrl('/');
364
- }
365
- }
366
- hasIntakeRole(roles) {
367
- if (roles && roles.length > 0) {
368
- return roles.findIndex(this.isIntakeRole) > -1;
369
- }
370
- return false;
371
- }
372
- isIntakeRole(role) {
373
- switch (role.roleId) {
374
- case 'OPA':
375
- case 'OPS':
376
- case 'SOPS':
377
- return true;
378
- default:
379
- return false;
380
- }
381
- }
382
- }
383
- /** @nocollapse */ SmartOffenderHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderComponent, deps: [{ token: XdmService }, { token: i2.MsalService }, { token: SmartOffenderHeaderService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
384
- /** @nocollapse */ SmartOffenderHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartOffenderHeaderComponent, selector: "app-smart-offender-header", ngImport: i0, template: "<div\n class=\"offender-header-container\"\n *ngIf=\"selectedOffender && isAuthenticated\">\n <div class=\"offender-header-name-item\">\n <mat-form-field appearance=\"standard\" class=\"switch-offender\">\n <mat-label>Switch Offender</mat-label>\n <mat-select [formControl]=\"selectedOffenderControl$\">\n <mat-option\n *ngFor=\"let offender of offenderQueryList\"\n [value]=\"offender\">\n {{ offender?.name}} ({{offender?.offenderId}})\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <div class=\"offender-header-id-item\">\n <span class=\"item-label\">PDID:</span> {{ selectedOffender.pdId }}\n </div>\n <div class=\"offender-header-id-item\">\n <span class=\"item-label\">CSOSA ID:</span>\n {{ selectedOffender.offenderId }}\n </div>\n </div>\n</div>\n", styles: [".offender-header-container{display:grid;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:grid;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width: 740px){.offender-header-container{display:grid;grid-template-rows:1fr 1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "component", type: i7.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i8$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderComponent, decorators: [{
386
- type: Component,
387
- args: [{ selector: 'app-smart-offender-header', template: "<div\n class=\"offender-header-container\"\n *ngIf=\"selectedOffender && isAuthenticated\">\n <div class=\"offender-header-name-item\">\n <mat-form-field appearance=\"standard\" class=\"switch-offender\">\n <mat-label>Switch Offender</mat-label>\n <mat-select [formControl]=\"selectedOffenderControl$\">\n <mat-option\n *ngFor=\"let offender of offenderQueryList\"\n [value]=\"offender\">\n {{ offender?.name}} ({{offender?.offenderId}})\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <div class=\"offender-header-id-item\">\n <span class=\"item-label\">PDID:</span> {{ selectedOffender.pdId }}\n </div>\n <div class=\"offender-header-id-item\">\n <span class=\"item-label\">CSOSA ID:</span>\n {{ selectedOffender.offenderId }}\n </div>\n </div>\n</div>\n", styles: [".offender-header-container{display:grid;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:grid;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width: 740px){.offender-header-container{display:grid;grid-template-rows:1fr 1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}\n"] }]
255
+ class SmartOffenderHeaderComponent {
256
+ // public isAuthenticated: boolean;
257
+ constructor(xdmService, authnService, smartOffenderHeaderService, router) {
258
+ this.xdmService = xdmService;
259
+ this.authnService = authnService;
260
+ this.smartOffenderHeaderService = smartOffenderHeaderService;
261
+ this.router = router;
262
+ this.selectedOffenderControl$ = new UntypedFormControl();
263
+ }
264
+ ngOnInit() {
265
+ // this.isAuthenticated = this.authnService.getAccount() ? true : false;
266
+ this.xdmService.getLoginStaff().then((loginStaff) => {
267
+ this.loginStaff = loginStaff ? loginStaff : null;
268
+ });
269
+ this.xdmService.getSelectedOffender().then((selectedOffender) => {
270
+ this.selectedOffender =
271
+ selectedOffender && selectedOffender.offenderId
272
+ ? selectedOffender
273
+ : null;
274
+ });
275
+ this.subscription = this.xdmService
276
+ .getOffenderUpdate()
277
+ .subscribe((selectedOffender) => {
278
+ this.selectedOffender = selectedOffender;
279
+ this.setSelectedOffenderControl();
280
+ });
281
+ this.xdmService.getOffenderQuery().then((offenderQuery) => {
282
+ if (offenderQuery) {
283
+ this.offenderQueryList = offenderQuery.offenders;
284
+ this.setSelectedOffenderControl();
285
+ }
286
+ });
287
+ this.offenderQuerySubscription = this.xdmService
288
+ .getOffenderQueryUpdate()
289
+ .subscribe((offenderList) => {
290
+ if (offenderList && offenderList.offenders) {
291
+ this.offenderQueryList = [...offenderList.offenders];
292
+ }
293
+ });
294
+ this.selectedOffenderControl$.valueChanges.subscribe((o) => this.onOffenderSelected(o));
295
+ this.router.routeReuseStrategy.shouldReuseRoute = () => {
296
+ return false;
297
+ };
298
+ }
299
+ get isAuthenticated() {
300
+ return this.authnService.instance.getAllAccounts().length > 0;
301
+ }
302
+ ngOnDestroy() {
303
+ this.subscription.unsubscribe();
304
+ }
305
+ onOffenderSelected(offender) {
306
+ if (offender) {
307
+ // const o = offender.offenderName.split(',');
308
+ // if (o.length === 2) {
309
+ // const offenderName = `${o[1]} ${o[0]}`;
310
+ // this.selectedOffender = {
311
+ // offenderId: offender.offenderId,
312
+ // name: offenderName,
313
+ // pdId: offender.pdId,
314
+ // birthDate: offender.birthDate,
315
+ // gender: offender.genderCode,
316
+ // assignmentStaffRelationId: '',
317
+ // intakeFlag: this.loginStaff
318
+ // ? this.hasIntakeRole(this.loginStaff.roles)
319
+ // : false,
320
+ // } as SelectedOffender;
321
+ this.selectedOffender = offender;
322
+ this.xdmService.setSelectedOffender(this.selectedOffender);
323
+ this.reloadCurrentRoute();
324
+ }
325
+ }
326
+ setSelectedOffenderControl() {
327
+ if (this.selectedOffender &&
328
+ this.offenderQueryList &&
329
+ this.offenderQueryList.length > 0) {
330
+ const o = this.offenderQueryList.find((x) => x.offenderId === this.selectedOffender.offenderId);
331
+ if (o) {
332
+ this.selectedOffenderControl$.setValue(o, { emitEvent: false });
333
+ }
334
+ if (!o && this.offenderQueryList.length > 0) {
335
+ this.selectedOffenderControl$.setValue(this.offenderQueryList[0], {
336
+ emitEvent: false,
337
+ });
338
+ }
339
+ }
340
+ }
341
+ reloadCurrentRoute() {
342
+ try {
343
+ const urlTree = this.router.parseUrl(this.router.url);
344
+ if (urlTree &&
345
+ urlTree.root &&
346
+ urlTree.root.segments &&
347
+ urlTree.root.segments.length > 1) {
348
+ this.router.navigate([urlTree.root.segments[0].path]);
349
+ }
350
+ else if (urlTree &&
351
+ urlTree.root &&
352
+ urlTree.root.children &&
353
+ urlTree.root.children.primary &&
354
+ urlTree.root.children.primary.segments &&
355
+ urlTree.root.children.primary.segments.length > 1) {
356
+ this.router.navigate([urlTree.root.children.primary.segments[0].path]);
357
+ }
358
+ else {
359
+ this.router.navigate([this.router.url]);
360
+ }
361
+ }
362
+ catch {
363
+ this.router.navigateByUrl('/');
364
+ }
365
+ }
366
+ hasIntakeRole(roles) {
367
+ if (roles && roles.length > 0) {
368
+ return roles.findIndex(this.isIntakeRole) > -1;
369
+ }
370
+ return false;
371
+ }
372
+ isIntakeRole(role) {
373
+ switch (role.roleId) {
374
+ case 'OPA':
375
+ case 'OPS':
376
+ case 'SOPS':
377
+ return true;
378
+ default:
379
+ return false;
380
+ }
381
+ }
382
+ }
383
+ /** @nocollapse */ SmartOffenderHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderComponent, deps: [{ token: XdmService }, { token: i2.MsalService }, { token: SmartOffenderHeaderService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
384
+ /** @nocollapse */ SmartOffenderHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartOffenderHeaderComponent, selector: "app-smart-offender-header", ngImport: i0, template: "<div\r\n class=\"offender-header-container\"\r\n *ngIf=\"selectedOffender && isAuthenticated\">\r\n <div class=\"offender-header-name-item\">\r\n <mat-form-field appearance=\"standard\" class=\"switch-offender\">\r\n <mat-label>Switch Offender</mat-label>\r\n <mat-select [formControl]=\"selectedOffenderControl$\">\r\n <mat-option\r\n *ngFor=\"let offender of offenderQueryList\"\r\n [value]=\"offender\">\r\n {{ offender?.name}} ({{offender?.offenderId}})\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">PDID:</span> {{ selectedOffender.pdId }}\r\n </div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">CSOSA ID:</span>\r\n {{ selectedOffender.offenderId }}\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".offender-header-container{display:grid;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:grid;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width: 740px){.offender-header-container{display:grid;grid-template-rows:1fr 1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "component", type: i7.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i8.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i8$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartOffenderHeaderComponent, decorators: [{
386
+ type: Component,
387
+ args: [{ selector: 'app-smart-offender-header', template: "<div\r\n class=\"offender-header-container\"\r\n *ngIf=\"selectedOffender && isAuthenticated\">\r\n <div class=\"offender-header-name-item\">\r\n <mat-form-field appearance=\"standard\" class=\"switch-offender\">\r\n <mat-label>Switch Offender</mat-label>\r\n <mat-select [formControl]=\"selectedOffenderControl$\">\r\n <mat-option\r\n *ngFor=\"let offender of offenderQueryList\"\r\n [value]=\"offender\">\r\n {{ offender?.name}} ({{offender?.offenderId}})\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">PDID:</span> {{ selectedOffender.pdId }}\r\n </div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">CSOSA ID:</span>\r\n {{ selectedOffender.offenderId }}\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".offender-header-container{display:grid;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:grid;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width: 740px){.offender-header-container{display:grid;grid-template-rows:1fr 1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,Helvetica Neue,sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}\n"] }]
388
388
  }], ctorParameters: function () { return [{ type: XdmService }, { type: i2.MsalService }, { type: SmartOffenderHeaderService }, { type: i2$1.Router }]; } });
389
389
 
390
- class SmartNavbarService {
391
- constructor(http) {
392
- this.http = http;
393
- }
394
- /*
395
- public getNavbarConfigs(): SmartNavbarConfig[] {
396
- this.configs = [
397
- {appModuleId: 'SMART', name: 'SMART', url: 'http://localhost:4200', offenderSpecific: false, displayOrder: 1 },
398
- {appModuleId: 'OFFENDER', name: 'Offender', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 2 },
399
- {appModuleId: 'SPRVSN', name: 'Supervision', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 3 },
400
- ];
401
-
402
- return this.configs;
403
- }
404
- */
405
- /*
406
- public getNavbarConfigs(serviceApiUrl: string): Observable<SmartNavbarConfig[]> {
407
- return this.http.get<SmartNavbarConfig[]>(serviceApiUrl + '/AppModules');
408
- }
409
- */
410
- getNavbarConfigs(serviceApiUrl) {
411
- const queryString = `
412
- {
413
- findAppModules {
414
- data {
415
- appModuleId
416
- name
417
- url
418
- offenderSpecificFlag
419
- displayOrder
420
- }
421
- }
422
- }`;
423
- /*
424
- const httpHeaders = new HttpHeaders({
425
- 'Content-Type': 'application/json',
426
- 'Cache-Control': 'no-cache'
427
- });
428
- const options = {
429
- headers: httpHeaders
430
- };
431
- */
432
- return this.http
433
- .post(serviceApiUrl, { query: queryString })
434
- .pipe(map(({ data }) => {
435
- if (isDevMode()) {
436
- console.log(data);
437
- }
438
- return data.findAppModules.data;
439
- }));
440
- }
441
- }
442
- /** @nocollapse */ SmartNavbarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
443
- /** @nocollapse */ SmartNavbarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService });
444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService, decorators: [{
445
- type: Injectable
390
+ class SmartNavbarService {
391
+ constructor(http) {
392
+ this.http = http;
393
+ }
394
+ /*
395
+ public getNavbarConfigs(): SmartNavbarConfig[] {
396
+ this.configs = [
397
+ {appModuleId: 'SMART', name: 'SMART', url: 'http://localhost:4200', offenderSpecific: false, displayOrder: 1 },
398
+ {appModuleId: 'OFFENDER', name: 'Offender', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 2 },
399
+ {appModuleId: 'SPRVSN', name: 'Supervision', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 3 },
400
+ ];
401
+
402
+ return this.configs;
403
+ }
404
+ */
405
+ /*
406
+ public getNavbarConfigs(serviceApiUrl: string): Observable<SmartNavbarConfig[]> {
407
+ return this.http.get<SmartNavbarConfig[]>(serviceApiUrl + '/AppModules');
408
+ }
409
+ */
410
+ getNavbarConfigs(serviceApiUrl) {
411
+ const queryString = `
412
+ {
413
+ findAppModules {
414
+ data {
415
+ appModuleId
416
+ name
417
+ url
418
+ offenderSpecificFlag
419
+ displayOrder
420
+ }
421
+ }
422
+ }`;
423
+ /*
424
+ const httpHeaders = new HttpHeaders({
425
+ 'Content-Type': 'application/json',
426
+ 'Cache-Control': 'no-cache'
427
+ });
428
+ const options = {
429
+ headers: httpHeaders
430
+ };
431
+ */
432
+ return this.http
433
+ .post(serviceApiUrl, { query: queryString })
434
+ .pipe(map(({ data }) => {
435
+ if (isDevMode()) {
436
+ console.log(data);
437
+ }
438
+ return data.findAppModules.data;
439
+ }));
440
+ }
441
+ }
442
+ /** @nocollapse */ SmartNavbarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
443
+ /** @nocollapse */ SmartNavbarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService });
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarService, decorators: [{
445
+ type: Injectable
446
446
  }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
447
447
 
448
- class SmartNavbarComponent {
449
- constructor(navbarConfigService, xdmService,
450
- // private zone: NgZone,
451
- authnService) {
452
- this.navbarConfigService = navbarConfigService;
453
- this.xdmService = xdmService;
454
- this.authnService = authnService;
455
- this.appModuleId = 'SMART';
456
- }
457
- ngOnChanges() {
458
- /*
459
- console.log(this.selectedTab);
460
- setTimeout(() => {
461
- this.tabGroup.selectedIndex = this.selectedTab;
462
- }, 1000);
463
- */
464
- }
465
- ngOnInit() {
466
- this.xdmService.getSelectedOffender().then((selectedOffender) => {
467
- this.selectedOffender =
468
- selectedOffender && selectedOffender.offenderId
469
- ? selectedOffender
470
- : null;
471
- });
472
- this.xdmService.getLoginStaff().then((loginStaff) => {
473
- // this.zone.run(() => {
474
- this.loginStaff = loginStaff ? loginStaff : null;
475
- // });
476
- });
477
- this.offenderSubscription = this.xdmService
478
- .getOffenderUpdate()
479
- .subscribe((selectedOffender) => {
480
- // this.zone.run(() => {
481
- this.selectedOffender = selectedOffender;
482
- // });
483
- });
484
- this.staffSubscription = this.xdmService
485
- .getStaffUpdate()
486
- .subscribe((loginStaff) => {
487
- // this.zone.run(() => {
488
- this.loginStaff = loginStaff;
489
- // });
490
- });
491
- this.navbarConfigService
492
- .getNavbarConfigs(this.serviceApiUrl)
493
- .subscribe((configs) => {
494
- this.navbarConfigs = configs.sort((a, b) => {
495
- if (a.displayOrder < b.displayOrder) {
496
- return -1;
497
- }
498
- else if (a.displayOrder > b.displayOrder) {
499
- return 1;
500
- }
501
- return 0;
502
- });
503
- });
504
- // this.isAuthenticated = this.authnService.getAccount() ? true : false;
505
- }
506
- ngOnDestroy() {
507
- this.offenderSubscription.unsubscribe();
508
- this.staffSubscription.unsubscribe();
509
- }
510
- logout() {
511
- this.xdmService.clearAll();
512
- this.authnService.logout();
513
- }
514
- get isAuthenticated() {
515
- return this.authnService.instance.getAllAccounts().length > 0;
516
- }
517
- getAppModuleUrl(config) {
518
- return config && this.selectedOffender && config.appModuleId === 'PPMAS'
519
- // ? `${config.url}?skipAppMetadata=true&OffenderId=${this.selectedOffender.offenderId}`
520
- ? `${config.url}&OffenderId=${this.selectedOffender.offenderId}`
521
- : config.url;
522
- }
523
- hasAppModulePermission(appModuleId) {
524
- if (this.loginStaff &&
525
- this.loginStaff.permissions &&
526
- this.loginStaff.permissions.length > 0) {
527
- return (this.loginStaff.permissions.findIndex((p) => p.appModuleId === appModuleId) > -1);
528
- }
529
- return false;
530
- }
531
- get hasExternalUserRole() {
532
- if (this.loginStaff &&
533
- this.loginStaff.roles &&
534
- this.loginStaff.roles.length > 0) {
535
- return this.loginStaff.roles.findIndex(this.isExternalRole) > -1;
536
- }
537
- return false;
538
- }
539
- checkDVIPPermission(config) {
540
- return ((config.appModuleId !== 'DVIP') || (config.appModuleId === "DVIP" && this.hasDVIPRole));
541
- }
542
- get hasDVIPRole() {
543
- if (this.loginStaff &&
544
- this.loginStaff.roles &&
545
- this.loginStaff.roles.length > 0) {
546
- return this.loginStaff.roles.findIndex(this.isDVIPRole) > -1;
547
- }
548
- return false;
549
- }
550
- isDVIPRole(role) {
551
- if (role.roleId == 'TSD' || role.roleId == 'TAD' || role.roleId == 'STSD' || role.roleId == 'BC') {
552
- return true;
553
- }
554
- return false;
555
- }
556
- checkVictimPermission(config) {
557
- return ((config.appModuleId !== 'VICTIM') || (config.appModuleId === "VICTIM" && this.hasVictimRole));
558
- }
559
- get hasVictimRole() {
560
- if (this.loginStaff &&
561
- this.loginStaff.roles &&
562
- this.loginStaff.roles.length > 0) {
563
- return this.loginStaff.roles.findIndex(this.isVictimRole) > -1;
564
- }
565
- return false;
566
- }
567
- isVictimRole(role) {
568
- if (role.roleId == 'BC' || role.roleId == 'VSP') {
569
- return true;
570
- }
571
- return false;
572
- }
573
- isExternalRole(role) {
574
- switch (role.roleId) {
575
- case 'EUDTL':
576
- case 'EUDUSM':
577
- case 'EUJDG':
578
- case 'EUMPD':
579
- case 'EUSOTV':
580
- case 'EUUSA2':
581
- case 'EUUSAO':
582
- case 'EUUSPC':
583
- return true;
584
- default:
585
- return false;
586
- }
587
- }
588
- }
589
- /** @nocollapse */ SmartNavbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarComponent, deps: [{ token: SmartNavbarService }, { token: XdmService }, { token: i2.MsalService }], target: i0.ɵɵFactoryTarget.Component });
590
- /** @nocollapse */ SmartNavbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartNavbarComponent, selector: "app-smart-navbar", inputs: { serviceApiUrl: "serviceApiUrl", appModuleId: "appModuleId" }, viewQueries: [{ propertyName: "tabGroup", first: true, predicate: ["tabs"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--\n<a class=\"smart-navbar-toggle open\" href=\"#nav\">\n <i class=\"material-icons\">menu</i>\n</a>\n\n<nav id=\"nav\" role=\"navigation\" class=\"smart-navbar-container\">\n <a class=\"smart-navbar-toggle close\" href=\"#\">\n <i class=\"material-icons\">close</i>\n </a>\n\n <span *ngFor=\"let config of navbarConfigs\">\n <a mat-button class=\"smart-navbar-item\" \n *ngIf=\"(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff\" href=\"{{config.url}}\">{{config.name}}</a>\n </span>\n\n <button mat-button class=\"smart-navbar-item\" [matMenuTriggerFor]=\"menuTheme\">Set Theme</button>\n <mat-menu #menuTheme=\"matMenu\">\n <button mat-menu-item (click)=\"onSetTheme('blue-theme')\">Blue</button>\n <button mat-menu-item (click)=\"onSetTheme('red-theme')\">Red</button>\n <button mat-menu-item (click)=\"onSetTheme('green-theme')\">Green</button>\n </mat-menu>\n <button mat-button class=\"smart-navbar-item smart-navbar-last-item\" [matMenuTriggerFor]=\"menu\"\n *ngIf=\"isAuthenticated && loginStaff\">{{loginStaff.firstName + ' ' + loginStaff.lastName}}</button>\n <mat-menu #menu=\"matMenu\">\n <button mat-menu-item>Profile</button>\n <button mat-menu-item (click)=\"logout()\">Sign Out</button>\n </mat-menu>\n</nav>\n-->\n\n<!-- <nav mat-tab-nav-bar>\n <a mat-tab-link mat-flat-button *ngFor=\"let config of navbarConfigs\" [active]=\"appModuleId == config.appModuleId\" href=\"{{config.url}}\">{{config.name}}</a>\n</nav> -->\n\n<mat-tab-group class=\"nav-tab-group\" [selectedIndex]=\"null\">\n <ng-container *ngFor=\"let config of navbarConfigs\">\n <mat-tab\n *ngIf=\"\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\n (!hasExternalUserRole && \n (config.offenderSpecificFlag === false || selectedOffender))) &&\n checkVictimPermission(config) &&\n isAuthenticated &&\n loginStaff\"\n label=\"config.name\">\n <ng-template mat-tab-label>\n <a\n mat-flat-button\n [ngClass]=\"{ 'main-menu-active': appModuleId == config.appModuleId }\"\n [href]=\"getAppModuleUrl(config)\"\n >{{ config.name }}</a>\n </ng-template>\n </mat-tab>\n </ng-container>\n</mat-tab-group>\n", styles: [".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color, #9fa8da);text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid darkblue!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width: 768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width: 767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translate(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i6$1.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i6$1.MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: i6$1.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }], encapsulation: i0.ViewEncapsulation.None });
591
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarComponent, decorators: [{
592
- type: Component,
593
- args: [{ selector: 'app-smart-navbar', encapsulation: ViewEncapsulation.None, template: "<!--\n<a class=\"smart-navbar-toggle open\" href=\"#nav\">\n <i class=\"material-icons\">menu</i>\n</a>\n\n<nav id=\"nav\" role=\"navigation\" class=\"smart-navbar-container\">\n <a class=\"smart-navbar-toggle close\" href=\"#\">\n <i class=\"material-icons\">close</i>\n </a>\n\n <span *ngFor=\"let config of navbarConfigs\">\n <a mat-button class=\"smart-navbar-item\" \n *ngIf=\"(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff\" href=\"{{config.url}}\">{{config.name}}</a>\n </span>\n\n <button mat-button class=\"smart-navbar-item\" [matMenuTriggerFor]=\"menuTheme\">Set Theme</button>\n <mat-menu #menuTheme=\"matMenu\">\n <button mat-menu-item (click)=\"onSetTheme('blue-theme')\">Blue</button>\n <button mat-menu-item (click)=\"onSetTheme('red-theme')\">Red</button>\n <button mat-menu-item (click)=\"onSetTheme('green-theme')\">Green</button>\n </mat-menu>\n <button mat-button class=\"smart-navbar-item smart-navbar-last-item\" [matMenuTriggerFor]=\"menu\"\n *ngIf=\"isAuthenticated && loginStaff\">{{loginStaff.firstName + ' ' + loginStaff.lastName}}</button>\n <mat-menu #menu=\"matMenu\">\n <button mat-menu-item>Profile</button>\n <button mat-menu-item (click)=\"logout()\">Sign Out</button>\n </mat-menu>\n</nav>\n-->\n\n<!-- <nav mat-tab-nav-bar>\n <a mat-tab-link mat-flat-button *ngFor=\"let config of navbarConfigs\" [active]=\"appModuleId == config.appModuleId\" href=\"{{config.url}}\">{{config.name}}</a>\n</nav> -->\n\n<mat-tab-group class=\"nav-tab-group\" [selectedIndex]=\"null\">\n <ng-container *ngFor=\"let config of navbarConfigs\">\n <mat-tab\n *ngIf=\"\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\n (!hasExternalUserRole && \n (config.offenderSpecificFlag === false || selectedOffender))) &&\n checkVictimPermission(config) &&\n isAuthenticated &&\n loginStaff\"\n label=\"config.name\">\n <ng-template mat-tab-label>\n <a\n mat-flat-button\n [ngClass]=\"{ 'main-menu-active': appModuleId == config.appModuleId }\"\n [href]=\"getAppModuleUrl(config)\"\n >{{ config.name }}</a>\n </ng-template>\n </mat-tab>\n </ng-container>\n</mat-tab-group>\n", styles: [".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color, #9fa8da);text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid darkblue!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width: 768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width: 767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translate(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}\n"] }]
594
- }], ctorParameters: function () { return [{ type: SmartNavbarService }, { type: XdmService }, { type: i2.MsalService }]; }, propDecorators: { serviceApiUrl: [{
595
- type: Input
596
- }], appModuleId: [{
597
- type: Input
598
- }], tabGroup: [{
599
- type: ViewChild,
600
- args: ['tabs']
448
+ class SmartNavbarComponent {
449
+ constructor(navbarConfigService, xdmService,
450
+ // private zone: NgZone,
451
+ authnService) {
452
+ this.navbarConfigService = navbarConfigService;
453
+ this.xdmService = xdmService;
454
+ this.authnService = authnService;
455
+ this.appModuleId = 'SMART';
456
+ }
457
+ ngOnChanges() {
458
+ /*
459
+ console.log(this.selectedTab);
460
+ setTimeout(() => {
461
+ this.tabGroup.selectedIndex = this.selectedTab;
462
+ }, 1000);
463
+ */
464
+ }
465
+ ngOnInit() {
466
+ this.xdmService.getSelectedOffender().then((selectedOffender) => {
467
+ this.selectedOffender =
468
+ selectedOffender && selectedOffender.offenderId
469
+ ? selectedOffender
470
+ : null;
471
+ });
472
+ this.xdmService.getLoginStaff().then((loginStaff) => {
473
+ // this.zone.run(() => {
474
+ this.loginStaff = loginStaff ? loginStaff : null;
475
+ // });
476
+ });
477
+ this.offenderSubscription = this.xdmService
478
+ .getOffenderUpdate()
479
+ .subscribe((selectedOffender) => {
480
+ // this.zone.run(() => {
481
+ this.selectedOffender = selectedOffender;
482
+ // });
483
+ });
484
+ this.staffSubscription = this.xdmService
485
+ .getStaffUpdate()
486
+ .subscribe((loginStaff) => {
487
+ // this.zone.run(() => {
488
+ this.loginStaff = loginStaff;
489
+ // });
490
+ });
491
+ this.navbarConfigService
492
+ .getNavbarConfigs(this.serviceApiUrl)
493
+ .subscribe((configs) => {
494
+ this.navbarConfigs = configs.sort((a, b) => {
495
+ if (a.displayOrder < b.displayOrder) {
496
+ return -1;
497
+ }
498
+ else if (a.displayOrder > b.displayOrder) {
499
+ return 1;
500
+ }
501
+ return 0;
502
+ });
503
+ });
504
+ // this.isAuthenticated = this.authnService.getAccount() ? true : false;
505
+ }
506
+ ngOnDestroy() {
507
+ this.offenderSubscription.unsubscribe();
508
+ this.staffSubscription.unsubscribe();
509
+ }
510
+ logout() {
511
+ this.xdmService.clearAll();
512
+ this.authnService.logout();
513
+ }
514
+ get isAuthenticated() {
515
+ return this.authnService.instance.getAllAccounts().length > 0;
516
+ }
517
+ getAppModuleUrl(config) {
518
+ return config && this.selectedOffender && config.appModuleId === 'PPMAS'
519
+ // ? `${config.url}?skipAppMetadata=true&OffenderId=${this.selectedOffender.offenderId}`
520
+ ? `${config.url}&OffenderId=${this.selectedOffender.offenderId}`
521
+ : config.url;
522
+ }
523
+ hasAppModulePermission(appModuleId) {
524
+ if (this.loginStaff &&
525
+ this.loginStaff.permissions &&
526
+ this.loginStaff.permissions.length > 0) {
527
+ return (this.loginStaff.permissions.findIndex((p) => p.appModuleId === appModuleId) > -1);
528
+ }
529
+ return false;
530
+ }
531
+ get hasExternalUserRole() {
532
+ if (this.loginStaff &&
533
+ this.loginStaff.roles &&
534
+ this.loginStaff.roles.length > 0) {
535
+ return this.loginStaff.roles.findIndex(this.isExternalRole) > -1;
536
+ }
537
+ return false;
538
+ }
539
+ checkDVIPPermission(config) {
540
+ return ((config.appModuleId !== 'DVIP') || (config.appModuleId === "DVIP" && this.hasDVIPRole));
541
+ }
542
+ get hasDVIPRole() {
543
+ if (this.loginStaff &&
544
+ this.loginStaff.roles &&
545
+ this.loginStaff.roles.length > 0) {
546
+ return this.loginStaff.roles.findIndex(this.isDVIPRole) > -1;
547
+ }
548
+ return false;
549
+ }
550
+ isDVIPRole(role) {
551
+ if (role.roleId == 'TSD' || role.roleId == 'TAD' || role.roleId == 'STSD' || role.roleId == 'BC') {
552
+ return true;
553
+ }
554
+ return false;
555
+ }
556
+ checkVictimPermission(config) {
557
+ return ((config.appModuleId !== 'VICTIM') || (config.appModuleId === "VICTIM" && this.hasVictimRole));
558
+ }
559
+ get hasVictimRole() {
560
+ if (this.loginStaff &&
561
+ this.loginStaff.roles &&
562
+ this.loginStaff.roles.length > 0) {
563
+ return this.loginStaff.roles.findIndex(this.isVictimRole) > -1;
564
+ }
565
+ return false;
566
+ }
567
+ isVictimRole(role) {
568
+ if (role.roleId == 'BC' || role.roleId == 'VSP') {
569
+ return true;
570
+ }
571
+ return false;
572
+ }
573
+ isExternalRole(role) {
574
+ switch (role.roleId) {
575
+ case 'EUDTL':
576
+ case 'EUDUSM':
577
+ case 'EUJDG':
578
+ case 'EUMPD':
579
+ case 'EUSOTV':
580
+ case 'EUUSA2':
581
+ case 'EUUSAO':
582
+ case 'EUUSPC':
583
+ return true;
584
+ default:
585
+ return false;
586
+ }
587
+ }
588
+ }
589
+ /** @nocollapse */ SmartNavbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarComponent, deps: [{ token: SmartNavbarService }, { token: XdmService }, { token: i2.MsalService }], target: i0.ɵɵFactoryTarget.Component });
590
+ /** @nocollapse */ SmartNavbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartNavbarComponent, selector: "app-smart-navbar", inputs: { serviceApiUrl: "serviceApiUrl", appModuleId: "appModuleId" }, viewQueries: [{ propertyName: "tabGroup", first: true, predicate: ["tabs"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--\r\n<a class=\"smart-navbar-toggle open\" href=\"#nav\">\r\n <i class=\"material-icons\">menu</i>\r\n</a>\r\n\r\n<nav id=\"nav\" role=\"navigation\" class=\"smart-navbar-container\">\r\n <a class=\"smart-navbar-toggle close\" href=\"#\">\r\n <i class=\"material-icons\">close</i>\r\n </a>\r\n\r\n <span *ngFor=\"let config of navbarConfigs\">\r\n <a mat-button class=\"smart-navbar-item\" \r\n *ngIf=\"(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff\" href=\"{{config.url}}\">{{config.name}}</a>\r\n </span>\r\n\r\n <button mat-button class=\"smart-navbar-item\" [matMenuTriggerFor]=\"menuTheme\">Set Theme</button>\r\n <mat-menu #menuTheme=\"matMenu\">\r\n <button mat-menu-item (click)=\"onSetTheme('blue-theme')\">Blue</button>\r\n <button mat-menu-item (click)=\"onSetTheme('red-theme')\">Red</button>\r\n <button mat-menu-item (click)=\"onSetTheme('green-theme')\">Green</button>\r\n </mat-menu>\r\n <button mat-button class=\"smart-navbar-item smart-navbar-last-item\" [matMenuTriggerFor]=\"menu\"\r\n *ngIf=\"isAuthenticated && loginStaff\">{{loginStaff.firstName + ' ' + loginStaff.lastName}}</button>\r\n <mat-menu #menu=\"matMenu\">\r\n <button mat-menu-item>Profile</button>\r\n <button mat-menu-item (click)=\"logout()\">Sign Out</button>\r\n </mat-menu>\r\n</nav>\r\n-->\r\n\r\n<!-- <nav mat-tab-nav-bar>\r\n <a mat-tab-link mat-flat-button *ngFor=\"let config of navbarConfigs\" [active]=\"appModuleId == config.appModuleId\" href=\"{{config.url}}\">{{config.name}}</a>\r\n</nav> -->\r\n\r\n<mat-tab-group class=\"nav-tab-group\" [selectedIndex]=\"null\">\r\n <ng-container *ngFor=\"let config of navbarConfigs\">\r\n <mat-tab\r\n *ngIf=\"\r\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\r\n (!hasExternalUserRole && \r\n (config.offenderSpecificFlag === false || selectedOffender))) &&\r\n checkVictimPermission(config) &&\r\n isAuthenticated &&\r\n loginStaff\"\r\n label=\"config.name\">\r\n <ng-template mat-tab-label>\r\n <a\r\n mat-flat-button\r\n [ngClass]=\"{ 'main-menu-active': appModuleId == config.appModuleId }\"\r\n [href]=\"getAppModuleUrl(config)\"\r\n >{{ config.name }}</a>\r\n </ng-template>\r\n </mat-tab>\r\n </ng-container>\r\n</mat-tab-group>\r\n", styles: [".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color, #9fa8da);text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid darkblue!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width: 768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width: 767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translate(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i6$1.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i6$1.MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: i6$1.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }], encapsulation: i0.ViewEncapsulation.None });
591
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartNavbarComponent, decorators: [{
592
+ type: Component,
593
+ args: [{ selector: 'app-smart-navbar', encapsulation: ViewEncapsulation.None, template: "<!--\r\n<a class=\"smart-navbar-toggle open\" href=\"#nav\">\r\n <i class=\"material-icons\">menu</i>\r\n</a>\r\n\r\n<nav id=\"nav\" role=\"navigation\" class=\"smart-navbar-container\">\r\n <a class=\"smart-navbar-toggle close\" href=\"#\">\r\n <i class=\"material-icons\">close</i>\r\n </a>\r\n\r\n <span *ngFor=\"let config of navbarConfigs\">\r\n <a mat-button class=\"smart-navbar-item\" \r\n *ngIf=\"(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff\" href=\"{{config.url}}\">{{config.name}}</a>\r\n </span>\r\n\r\n <button mat-button class=\"smart-navbar-item\" [matMenuTriggerFor]=\"menuTheme\">Set Theme</button>\r\n <mat-menu #menuTheme=\"matMenu\">\r\n <button mat-menu-item (click)=\"onSetTheme('blue-theme')\">Blue</button>\r\n <button mat-menu-item (click)=\"onSetTheme('red-theme')\">Red</button>\r\n <button mat-menu-item (click)=\"onSetTheme('green-theme')\">Green</button>\r\n </mat-menu>\r\n <button mat-button class=\"smart-navbar-item smart-navbar-last-item\" [matMenuTriggerFor]=\"menu\"\r\n *ngIf=\"isAuthenticated && loginStaff\">{{loginStaff.firstName + ' ' + loginStaff.lastName}}</button>\r\n <mat-menu #menu=\"matMenu\">\r\n <button mat-menu-item>Profile</button>\r\n <button mat-menu-item (click)=\"logout()\">Sign Out</button>\r\n </mat-menu>\r\n</nav>\r\n-->\r\n\r\n<!-- <nav mat-tab-nav-bar>\r\n <a mat-tab-link mat-flat-button *ngFor=\"let config of navbarConfigs\" [active]=\"appModuleId == config.appModuleId\" href=\"{{config.url}}\">{{config.name}}</a>\r\n</nav> -->\r\n\r\n<mat-tab-group class=\"nav-tab-group\" [selectedIndex]=\"null\">\r\n <ng-container *ngFor=\"let config of navbarConfigs\">\r\n <mat-tab\r\n *ngIf=\"\r\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\r\n (!hasExternalUserRole && \r\n (config.offenderSpecificFlag === false || selectedOffender))) &&\r\n checkVictimPermission(config) &&\r\n isAuthenticated &&\r\n loginStaff\"\r\n label=\"config.name\">\r\n <ng-template mat-tab-label>\r\n <a\r\n mat-flat-button\r\n [ngClass]=\"{ 'main-menu-active': appModuleId == config.appModuleId }\"\r\n [href]=\"getAppModuleUrl(config)\"\r\n >{{ config.name }}</a>\r\n </ng-template>\r\n </mat-tab>\r\n </ng-container>\r\n</mat-tab-group>\r\n", styles: [".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color, #9fa8da);text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid darkblue!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width: 768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width: 767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translate(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}\n"] }]
594
+ }], ctorParameters: function () { return [{ type: SmartNavbarService }, { type: XdmService }, { type: i2.MsalService }]; }, propDecorators: { serviceApiUrl: [{
595
+ type: Input
596
+ }], appModuleId: [{
597
+ type: Input
598
+ }], tabGroup: [{
599
+ type: ViewChild,
600
+ args: ['tabs']
601
601
  }] } });
602
602
 
603
- class SmartErrorComponent {
604
- constructor(authnService, route, smartWebPortalUrl) {
605
- this.authnService = authnService;
606
- this.route = route;
607
- this.smartWebPortalUrl = smartWebPortalUrl;
608
- }
609
- ngOnInit() {
610
- this.type = this.route.snapshot.queryParamMap.get('type') || 'staff';
611
- this.message =
612
- this.route.snapshot.queryParamMap.get('message') || 'Error occured.';
613
- }
614
- logout() {
615
- this.authnService.logout();
616
- }
617
- portal() {
618
- window.location.href = this.smartWebPortalUrl;
619
- }
620
- }
621
- /** @nocollapse */ SmartErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartErrorComponent, deps: [{ token: i2.MsalService }, { token: i2$1.ActivatedRoute }, { token: SMART_WEB_PORTAL_URL }], target: i0.ɵɵFactoryTarget.Component });
622
- /** @nocollapse */ SmartErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartErrorComponent, selector: "app-smart-error", ngImport: i0, template: "<div>\n <h2>\n {{ message }}\n </h2>\n <p>\n Please contact help desk if needed.\n </p>\n <div>\n <button (click)=\"logout()\" *ngIf=\"type === 'staff'\">OK</button>\n <button (click)=\"portal()\" *ngIf=\"type === 'offender'\">OK</button>\n </div>\n</div>\n", styles: ["div{text-align:center}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
623
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartErrorComponent, decorators: [{
624
- type: Component,
625
- args: [{ selector: 'app-smart-error', template: "<div>\n <h2>\n {{ message }}\n </h2>\n <p>\n Please contact help desk if needed.\n </p>\n <div>\n <button (click)=\"logout()\" *ngIf=\"type === 'staff'\">OK</button>\n <button (click)=\"portal()\" *ngIf=\"type === 'offender'\">OK</button>\n </div>\n</div>\n", styles: ["div{text-align:center}\n"] }]
626
- }], ctorParameters: function () { return [{ type: i2.MsalService }, { type: i2$1.ActivatedRoute }, { type: undefined, decorators: [{
627
- type: Inject,
628
- args: [SMART_WEB_PORTAL_URL]
603
+ class SmartErrorComponent {
604
+ constructor(authnService, route, smartWebPortalUrl) {
605
+ this.authnService = authnService;
606
+ this.route = route;
607
+ this.smartWebPortalUrl = smartWebPortalUrl;
608
+ }
609
+ ngOnInit() {
610
+ this.type = this.route.snapshot.queryParamMap.get('type') || 'staff';
611
+ this.message =
612
+ this.route.snapshot.queryParamMap.get('message') || 'Error occured.';
613
+ }
614
+ logout() {
615
+ this.authnService.logout();
616
+ }
617
+ portal() {
618
+ window.location.href = this.smartWebPortalUrl;
619
+ }
620
+ }
621
+ /** @nocollapse */ SmartErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartErrorComponent, deps: [{ token: i2.MsalService }, { token: i2$1.ActivatedRoute }, { token: SMART_WEB_PORTAL_URL }], target: i0.ɵɵFactoryTarget.Component });
622
+ /** @nocollapse */ SmartErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartErrorComponent, selector: "app-smart-error", ngImport: i0, template: "<div>\r\n <h2>\r\n {{ message }}\r\n </h2>\r\n <p>\r\n Please contact help desk if needed.\r\n </p>\r\n <div>\r\n <button (click)=\"logout()\" *ngIf=\"type === 'staff'\">OK</button>\r\n <button (click)=\"portal()\" *ngIf=\"type === 'offender'\">OK</button>\r\n </div>\r\n</div>\r\n", styles: ["div{text-align:center}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartErrorComponent, decorators: [{
624
+ type: Component,
625
+ args: [{ selector: 'app-smart-error', template: "<div>\r\n <h2>\r\n {{ message }}\r\n </h2>\r\n <p>\r\n Please contact help desk if needed.\r\n </p>\r\n <div>\r\n <button (click)=\"logout()\" *ngIf=\"type === 'staff'\">OK</button>\r\n <button (click)=\"portal()\" *ngIf=\"type === 'offender'\">OK</button>\r\n </div>\r\n</div>\r\n", styles: ["div{text-align:center}\n"] }]
626
+ }], ctorParameters: function () { return [{ type: i2.MsalService }, { type: i2$1.ActivatedRoute }, { type: undefined, decorators: [{
627
+ type: Inject,
628
+ args: [SMART_WEB_PORTAL_URL]
629
629
  }] }]; } });
630
630
 
631
- class SmartStaffOffenderOptionsService {
632
- constructor(http, matSnackBar, serviceApiUrl) {
633
- this.http = http;
634
- this.matSnackBar = matSnackBar;
635
- this.serviceApiUrl = serviceApiUrl;
636
- }
637
- showMessage(message) {
638
- this.matSnackBar.open(message, null, {
639
- duration: 2000,
640
- });
641
- }
642
- convertEmptyToNull(jsonObject) {
643
- if (!jsonObject) {
644
- return;
645
- }
646
- if (jsonObject instanceof Array) {
647
- jsonObject.forEach((obj) => {
648
- this.convertEmptyToNull(obj);
649
- });
650
- }
651
- const keys = Object.keys(jsonObject);
652
- keys.forEach((key) => {
653
- if (typeof jsonObject[key] === 'object') {
654
- this.convertEmptyToNull(jsonObject[key]);
655
- }
656
- else if (typeof jsonObject[key] === 'string' &&
657
- jsonObject[key].trim() === '') {
658
- jsonObject[key] = null;
659
- }
660
- });
661
- }
662
- getGraphQueryData(queryName, queryString) {
663
- return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
664
- return data[queryName];
665
- }));
666
- }
667
- getOffenderListOptions() {
668
- const queryString = `{findOffenderListOptions(input:{
669
- where:{
670
- deactivatedDate: null
671
- }
672
- }){
673
- data{
674
- offenderListOptionId
675
- name
676
- serviceApiFieldName
677
- }
678
- } }`;
679
- return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
680
- return data['findOffenderListOptions'];
681
- }));
682
- }
683
- getStaffOffenderListOptions(staffId) {
684
- const queryString = `{findStaffOffenderListOptions(input:{
685
- where:{
686
- staffId: ${staffId}
687
- }
688
- }){
689
- data{
690
- offenderListOptionId
691
- }
692
- } }`;
693
- return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
694
- return data.findStaffOffenderListOptions.data;
695
- }));
696
- }
697
- saveStaffOffenderListOptionsData(dataToSave) {
698
- //}: Observable<any> {
699
- // this.convertEmptyToNull(dataToSave);
700
- const queryName = 'upsertStaffOffenderListOption';
701
- const query = `mutation {
702
- upsertStaffOffenderListOption(input: ${this.convertToString(dataToSave)}) {
703
- message
704
- }
705
- }`;
706
- return this.http.post(this.serviceApiUrl, { query });
707
- /*.pipe(
708
- map(({ data }) => {
709
- return data[queryName];
710
- }));*/
711
- }
712
- convertToString(obj) {
713
- let result = '';
714
- if (!obj) {
715
- return result;
716
- }
717
- if (obj instanceof Array) {
718
- result += ' [';
719
- obj.forEach((eObj) => {
720
- result += this.convertToString(eObj);
721
- });
722
- result += '],';
723
- }
724
- else {
725
- result += '{';
726
- const keys = Object.keys(obj);
727
- keys.forEach((key) => {
728
- if (typeof obj[key] === 'object') {
729
- result += key + ':' + this.convertToString(obj[key]);
730
- }
731
- else {
732
- if (isNaN(obj[key])) {
733
- result += key + ':"' + obj[key] + '",';
734
- }
735
- else {
736
- result += key + ':' + obj[key] + ',';
737
- }
738
- }
739
- });
740
- result = result.substring(0, result.length - 1);
741
- result += '},';
742
- }
743
- return result;
744
- }
745
- }
746
- /** @nocollapse */ SmartStaffOffenderOptionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService, deps: [{ token: i1.HttpClient }, { token: i2$2.MatSnackBar }, { token: SMART_DATA_SERVICE_URL }], target: i0.ɵɵFactoryTarget.Injectable });
747
- /** @nocollapse */ SmartStaffOffenderOptionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService });
748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService, decorators: [{
749
- type: Injectable
750
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2$2.MatSnackBar }, { type: undefined, decorators: [{
751
- type: Inject,
752
- args: [SMART_DATA_SERVICE_URL]
631
+ class SmartStaffOffenderOptionsService {
632
+ constructor(http, matSnackBar, serviceApiUrl) {
633
+ this.http = http;
634
+ this.matSnackBar = matSnackBar;
635
+ this.serviceApiUrl = serviceApiUrl;
636
+ }
637
+ showMessage(message) {
638
+ this.matSnackBar.open(message, null, {
639
+ duration: 2000,
640
+ });
641
+ }
642
+ convertEmptyToNull(jsonObject) {
643
+ if (!jsonObject) {
644
+ return;
645
+ }
646
+ if (jsonObject instanceof Array) {
647
+ jsonObject.forEach((obj) => {
648
+ this.convertEmptyToNull(obj);
649
+ });
650
+ }
651
+ const keys = Object.keys(jsonObject);
652
+ keys.forEach((key) => {
653
+ if (typeof jsonObject[key] === 'object') {
654
+ this.convertEmptyToNull(jsonObject[key]);
655
+ }
656
+ else if (typeof jsonObject[key] === 'string' &&
657
+ jsonObject[key].trim() === '') {
658
+ jsonObject[key] = null;
659
+ }
660
+ });
661
+ }
662
+ getGraphQueryData(queryName, queryString) {
663
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
664
+ return data[queryName];
665
+ }));
666
+ }
667
+ getOffenderListOptions() {
668
+ const queryString = `{findOffenderListOptions(input:{
669
+ where:{
670
+ deactivatedDate: null
671
+ }
672
+ }){
673
+ data{
674
+ offenderListOptionId
675
+ name
676
+ serviceApiFieldName
677
+ }
678
+ } }`;
679
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
680
+ return data['findOffenderListOptions'];
681
+ }));
682
+ }
683
+ getStaffOffenderListOptions(staffId) {
684
+ const queryString = `{findStaffOffenderListOptions(input:{
685
+ where:{
686
+ staffId: ${staffId}
687
+ }
688
+ }){
689
+ data{
690
+ offenderListOptionId
691
+ }
692
+ } }`;
693
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
694
+ return data.findStaffOffenderListOptions.data;
695
+ }));
696
+ }
697
+ saveStaffOffenderListOptionsData(dataToSave) {
698
+ //}: Observable<any> {
699
+ // this.convertEmptyToNull(dataToSave);
700
+ const queryName = 'upsertStaffOffenderListOption';
701
+ const query = `mutation {
702
+ upsertStaffOffenderListOption(input: ${this.convertToString(dataToSave)}) {
703
+ message
704
+ }
705
+ }`;
706
+ return this.http.post(this.serviceApiUrl, { query });
707
+ /*.pipe(
708
+ map(({ data }) => {
709
+ return data[queryName];
710
+ }));*/
711
+ }
712
+ convertToString(obj) {
713
+ let result = '';
714
+ if (!obj) {
715
+ return result;
716
+ }
717
+ if (obj instanceof Array) {
718
+ result += ' [';
719
+ obj.forEach((eObj) => {
720
+ result += this.convertToString(eObj);
721
+ });
722
+ result += '],';
723
+ }
724
+ else {
725
+ result += '{';
726
+ const keys = Object.keys(obj);
727
+ keys.forEach((key) => {
728
+ if (typeof obj[key] === 'object') {
729
+ result += key + ':' + this.convertToString(obj[key]);
730
+ }
731
+ else {
732
+ if (isNaN(obj[key])) {
733
+ result += key + ':"' + obj[key] + '",';
734
+ }
735
+ else {
736
+ result += key + ':' + obj[key] + ',';
737
+ }
738
+ }
739
+ });
740
+ result = result.substring(0, result.length - 1);
741
+ result += '},';
742
+ }
743
+ return result;
744
+ }
745
+ }
746
+ /** @nocollapse */ SmartStaffOffenderOptionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService, deps: [{ token: i1.HttpClient }, { token: i2$2.MatSnackBar }, { token: SMART_DATA_SERVICE_URL }], target: i0.ɵɵFactoryTarget.Injectable });
747
+ /** @nocollapse */ SmartStaffOffenderOptionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService });
748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsService, decorators: [{
749
+ type: Injectable
750
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2$2.MatSnackBar }, { type: undefined, decorators: [{
751
+ type: Inject,
752
+ args: [SMART_DATA_SERVICE_URL]
753
753
  }] }]; } });
754
754
 
755
- class SmartStaffOffenderOptionsComponent {
756
- constructor(route, offenderService, xdmService) {
757
- this.route = route;
758
- this.offenderService = offenderService;
759
- this.xdmService = xdmService;
760
- this.offenderListOptions = [];
761
- }
762
- ngOnInit() {
763
- const routData = this.route.snapshot.data;
764
- this.loginStaff = routData.loginStaff;
765
- this.offenderListOptions = routData.selectedOffenderResolverService;
766
- this.frmGroup = this.createForm();
767
- this.offenderService.getStaffOffenderListOptions(this.loginStaff.staffId).subscribe(data => {
768
- this.fillForm(data);
769
- });
770
- }
771
- fillForm(data) {
772
- if (data) {
773
- const offenderListOptionsFg = this.frmGroup.get('offenderListOptions');
774
- data.forEach(element => {
775
- offenderListOptionsFg.get(element.offenderListOptionId).setValue(true);
776
- });
777
- }
778
- }
779
- createForm() {
780
- const offenderListOptionsFg = new UntypedFormGroup({});
781
- this.offenderListOptions.forEach((dt, i) => {
782
- offenderListOptionsFg.addControl(dt.offenderListOptionId, new UntypedFormControl(false));
783
- });
784
- return new UntypedFormGroup({
785
- offenderListOptions: offenderListOptionsFg,
786
- });
787
- }
788
- onSave() {
789
- const data = {
790
- options: [],
791
- staffId: this.loginStaff.staffId,
792
- modifiedBy: this.loginStaff.staffId
793
- };
794
- const offenderListOptionsVal = this.frmGroup.get('offenderListOptions').value;
795
- const keys = Object.keys(offenderListOptionsVal);
796
- keys.forEach(key => {
797
- if (offenderListOptionsVal[key]) {
798
- data.options.push({ 'offenderListOptionId': key });
799
- }
800
- });
801
- this.offenderService.saveStaffOffenderListOptionsData(data).subscribe(rtrDatea => {
802
- if (rtrDatea.message) {
803
- this.offenderService.showMessage(rtrDatea.message);
804
- }
805
- else {
806
- this.offenderService.showMessage('Saved successfully');
807
- this.xdmService.refreshLoginStaffOptions();
808
- }
809
- });
810
- }
811
- }
812
- /** @nocollapse */ SmartStaffOffenderOptionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsComponent, deps: [{ token: i2$1.ActivatedRoute }, { token: SmartStaffOffenderOptionsService }, { token: XdmService }], target: i0.ɵɵFactoryTarget.Component });
813
- /** @nocollapse */ SmartStaffOffenderOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartStaffOffenderOptionsComponent, selector: "lib-smart-staff-offender-options", ngImport: i0, template: "<form class=\"main-form\" [formGroup]=\"frmGroup\">\n <mat-card role=\"group\">\n <mat-card-content>\n <div formGroupName=\"offenderListOptions\">\n <div style=\"float:left;\">\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\">\n <mat-checkbox *ngIf=\"i%2!=0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\n {{offenderListOption.name}}\n </mat-checkbox>\n </div>\n </div>\n <div>\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\" >\n <mat-checkbox *ngIf=\"i%2==0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\n {{offenderListOption.name}}\n </mat-checkbox> \n </div>\n </div>\n </div>\n </mat-card-content>\n <div align=\"center\">\n <button mat-raised-button color=\"accent\" (click)=\"onSave()\">Save</button>\n </div>\n </mat-card>\n </form>\n ", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$2.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i6$2.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "component", type: i7$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i8$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i8$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }] });
814
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsComponent, decorators: [{
815
- type: Component,
816
- args: [{ selector: 'lib-smart-staff-offender-options', template: "<form class=\"main-form\" [formGroup]=\"frmGroup\">\n <mat-card role=\"group\">\n <mat-card-content>\n <div formGroupName=\"offenderListOptions\">\n <div style=\"float:left;\">\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\">\n <mat-checkbox *ngIf=\"i%2!=0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\n {{offenderListOption.name}}\n </mat-checkbox>\n </div>\n </div>\n <div>\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\" >\n <mat-checkbox *ngIf=\"i%2==0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\n {{offenderListOption.name}}\n </mat-checkbox> \n </div>\n </div>\n </div>\n </mat-card-content>\n <div align=\"center\">\n <button mat-raised-button color=\"accent\" (click)=\"onSave()\">Save</button>\n </div>\n </mat-card>\n </form>\n " }]
755
+ class SmartStaffOffenderOptionsComponent {
756
+ constructor(route, offenderService, xdmService) {
757
+ this.route = route;
758
+ this.offenderService = offenderService;
759
+ this.xdmService = xdmService;
760
+ this.offenderListOptions = [];
761
+ }
762
+ ngOnInit() {
763
+ const routData = this.route.snapshot.data;
764
+ this.loginStaff = routData.loginStaff;
765
+ this.offenderListOptions = routData.selectedOffenderResolverService;
766
+ this.frmGroup = this.createForm();
767
+ this.offenderService.getStaffOffenderListOptions(this.loginStaff.staffId).subscribe(data => {
768
+ this.fillForm(data);
769
+ });
770
+ }
771
+ fillForm(data) {
772
+ if (data) {
773
+ const offenderListOptionsFg = this.frmGroup.get('offenderListOptions');
774
+ data.forEach(element => {
775
+ offenderListOptionsFg.get(element.offenderListOptionId).setValue(true);
776
+ });
777
+ }
778
+ }
779
+ createForm() {
780
+ const offenderListOptionsFg = new UntypedFormGroup({});
781
+ this.offenderListOptions.forEach((dt, i) => {
782
+ offenderListOptionsFg.addControl(dt.offenderListOptionId, new UntypedFormControl(false));
783
+ });
784
+ return new UntypedFormGroup({
785
+ offenderListOptions: offenderListOptionsFg,
786
+ });
787
+ }
788
+ onSave() {
789
+ const data = {
790
+ options: [],
791
+ staffId: this.loginStaff.staffId,
792
+ modifiedBy: this.loginStaff.staffId
793
+ };
794
+ const offenderListOptionsVal = this.frmGroup.get('offenderListOptions').value;
795
+ const keys = Object.keys(offenderListOptionsVal);
796
+ keys.forEach(key => {
797
+ if (offenderListOptionsVal[key]) {
798
+ data.options.push({ 'offenderListOptionId': key });
799
+ }
800
+ });
801
+ this.offenderService.saveStaffOffenderListOptionsData(data).subscribe(rtrDatea => {
802
+ if (rtrDatea.message) {
803
+ this.offenderService.showMessage(rtrDatea.message);
804
+ }
805
+ else {
806
+ this.offenderService.showMessage('Saved successfully');
807
+ this.xdmService.refreshLoginStaffOptions();
808
+ }
809
+ });
810
+ }
811
+ }
812
+ /** @nocollapse */ SmartStaffOffenderOptionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsComponent, deps: [{ token: i2$1.ActivatedRoute }, { token: SmartStaffOffenderOptionsService }, { token: XdmService }], target: i0.ɵɵFactoryTarget.Component });
813
+ /** @nocollapse */ SmartStaffOffenderOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SmartStaffOffenderOptionsComponent, selector: "lib-smart-staff-offender-options", ngImport: i0, template: "<form class=\"main-form\" [formGroup]=\"frmGroup\">\r\n <mat-card role=\"group\">\r\n <mat-card-content>\r\n <div formGroupName=\"offenderListOptions\">\r\n <div style=\"float:left;\">\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\">\r\n <mat-checkbox *ngIf=\"i%2!=0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox>\r\n </div>\r\n </div>\r\n <div>\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\" >\r\n <mat-checkbox *ngIf=\"i%2==0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox> \r\n </div>\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n <div align=\"center\">\r\n <button mat-raised-button color=\"accent\" (click)=\"onSave()\">Save</button>\r\n </div>\r\n </mat-card>\r\n </form>\r\n ", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$2.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i6$2.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "component", type: i7$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i8$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i8$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }] });
814
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsComponent, decorators: [{
815
+ type: Component,
816
+ args: [{ selector: 'lib-smart-staff-offender-options', template: "<form class=\"main-form\" [formGroup]=\"frmGroup\">\r\n <mat-card role=\"group\">\r\n <mat-card-content>\r\n <div formGroupName=\"offenderListOptions\">\r\n <div style=\"float:left;\">\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\">\r\n <mat-checkbox *ngIf=\"i%2!=0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox>\r\n </div>\r\n </div>\r\n <div>\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\" >\r\n <mat-checkbox *ngIf=\"i%2==0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox> \r\n </div>\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n <div align=\"center\">\r\n <button mat-raised-button color=\"accent\" (click)=\"onSave()\">Save</button>\r\n </div>\r\n </mat-card>\r\n </form>\r\n " }]
817
817
  }], ctorParameters: function () { return [{ type: i2$1.ActivatedRoute }, { type: SmartStaffOffenderOptionsService }, { type: XdmService }]; } });
818
818
 
819
- class SmartAuthService {
820
- constructor(http, authnService, xdmService, smartDataServiceUrl, smartDomainFormatUrl) {
821
- this.http = http;
822
- this.authnService = authnService;
823
- this.xdmService = xdmService;
824
- this.smartDataServiceUrl = smartDataServiceUrl;
825
- this.smartDomainFormatUrl = smartDomainFormatUrl;
826
- }
827
- getLoginStaff() {
828
- if (isDevMode) {
829
- console.log('SmartAuthService - getLoginStaff()');
830
- }
831
- if (!isDevMode && this.loginStaff) {
832
- if (this.loginStaff.staffId) {
833
- if (isDevMode) {
834
- console.log('##### getLoginStaff(): get internal instance in service', this.loginStaff);
835
- }
836
- return of(this.loginStaff);
837
- }
838
- else if (this.loginStaff.userName) {
839
- if (isDevMode) {
840
- console.log('##### getLoginStaff(): get using preset user name', this.loginStaff);
841
- }
842
- return this.getStaff(this.loginStaff.userName);
843
- }
844
- }
845
- return from(this.xdmService.getLoginStaff()).pipe(switchMap((storedResult) => {
846
- if (storedResult && storedResult.staffId) {
847
- if (isDevMode) {
848
- console.log('##### getLoginStaff(): get from session.', storedResult);
849
- }
850
- this.loginStaff = storedResult;
851
- return of(storedResult);
852
- }
853
- else if (storedResult && storedResult.userName) {
854
- if (isDevMode) {
855
- console.log('##### getLoginStaff(): get using preset user name', this.loginStaff);
856
- }
857
- return this.getStaff(storedResult.userName);
858
- }
859
- else {
860
- const userName = this.userName;
861
- const staffName = userName.substring(0, userName.indexOf('@'));
862
- if (isDevMode) {
863
- console.log('##### loginLoginStaff(): get using login staff name ', staffName);
864
- }
865
- return this.getStaff(staffName);
866
- }
867
- }));
868
- }
869
- get userName() {
870
- if (this.authnService.instance.getAllAccounts().length > 0) {
871
- const account = this.authnService.instance.getAllAccounts()[0];
872
- return account.username;
873
- }
874
- return '';
875
- }
876
- getTeamUrl(app, afterHash) {
877
- return this.smartDomainFormatUrl.replace('${APP}', app) + afterHash;
878
- }
879
- isSameHost(url, app) {
880
- return this.smartDomainFormatUrl.replace('${APP}', app) === url;
881
- }
882
- redirectToTeam(loginStaff) {
883
- if (loginStaff.roles.findIndex((role) => role.roleId === 'EUUSPC') > -1) {
884
- if (!this.isSameHost(window.location.origin, 'investigation')) {
885
- window.location.href = this.getTeamUrl('investigation', '/assignment');
886
- }
887
- }
888
- else if (loginStaff.roles.findIndex((role) => role.roleId.substring(0, 3) === 'RSC') > -1) {
889
- if (!this.isSameHost(window.location.origin, 'rsc')) {
890
- window.location.href = this.getTeamUrl('rsc', '/offender-list');
891
- }
892
- }
893
- }
894
- async setSelectedOffender(selectedOffender) {
895
- if (!this.loginStaff) {
896
- return;
897
- }
898
- if (selectedOffender) {
899
- // if (!selectedOffender.assignmentStaffRelationId) {
900
- const relation = await lastValueFrom(this.getStaffOffenderRelation(this.loginStaff.staffId, selectedOffender.offenderId));
901
- if (relation) {
902
- selectedOffender.assignmentStaffRelationId = relation;
903
- }
904
- else {
905
- selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
906
- }
907
- // }
908
- }
909
- this.xdmService.setSelectedOffender(selectedOffender);
910
- this.selectedOffender = selectedOffender;
911
- }
912
- logout() {
913
- this.xdmService.clearAll();
914
- this.authnService.logout();
915
- }
916
- async setPermission(appModuleId, route) {
917
- if (!this.loginStaff) {
918
- this.loginStaff = await this.xdmService.getLoginStaff();
919
- }
920
- const permissions = this.loginStaff.permissions;
921
- const resource = route.url && route.url.length > 0 ? route.url[0].path : '';
922
- if (!this.selectedOffender) {
923
- this.selectedOffender = await this.xdmService.getSelectedOffender();
924
- }
925
- if (this.selectedOffender) {
926
- // if (!this.selectedOffender.assignmentStaffRelationId) {
927
- const relation = await this.getStaffOffenderRelation(this.loginStaff.staffId, this.selectedOffender.offenderId).toPromise();
928
- if (relation) {
929
- this.selectedOffender.assignmentStaffRelationId = relation;
930
- }
931
- else {
932
- this.selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
933
- }
934
- this.xdmService.setSelectedOffender(this.selectedOffender);
935
- // }
936
- }
937
- const assignmentStaffRelationId = this.selectedOffender.assignmentStaffRelationId;
938
- const elements = document.querySelectorAll('[class^="sac-"]');
939
- const pattern = /^sac-(\S+)-(\S+)$/i;
940
- Array.from(elements).forEach((element) => {
941
- let hide;
942
- let disable;
943
- element.classList.forEach((c) => {
944
- const results = c.match(pattern);
945
- // console.log(results);
946
- if (results && results.length > 2) {
947
- const roleId = results[1] ? results[1].toUpperCase() : null;
948
- const right = results[2];
949
- // console.log(results[0]);
950
- // console.log(results[1]);
951
- // console.log(results[2]);
952
- const permission = permissions.find(function (p) {
953
- return (p.appModuleId === appModuleId &&
954
- p.resource === resource &&
955
- p.roleId === roleId &&
956
- p.assignmentStaffRelationId === assignmentStaffRelationId);
957
- });
958
- /*
959
- console.log('##### setPermission() resource: ', resource);
960
- console.log('##### setPermission() appModuleId: ', appModuleId);
961
- console.log('##### setPermission() roleId: ', roleId);
962
- console.log(
963
- '##### setPermission() assignment relation: ',
964
- assignmentStaffRelationId,
965
- );
966
- */
967
- console.log('##### Matched permission: ', permission);
968
- if (permission) {
969
- if (right === 'read') {
970
- if (!permission.readFlag) {
971
- if (hide !== false) {
972
- hide = true;
973
- }
974
- }
975
- else {
976
- hide = false;
977
- }
978
- }
979
- else if ((right === 'create' && !permission.createFlag) ||
980
- (right === 'update' && !permission.updateFlag) ||
981
- (right === 'delete' && !permission.deleteFlag) ||
982
- (right === 'assign' && !permission.assignFlag) ||
983
- (right === 'close' && !permission.closeFlag) ||
984
- (right === 'expunge' && !permission.expungeFlag) ||
985
- (right === 'reopen' && !permission.reopenFlag)) {
986
- if (element.nodeName === 'BUTTON') {
987
- if (hide !== false) {
988
- hide = true;
989
- }
990
- }
991
- else {
992
- if (disable !== false) {
993
- disable = true;
994
- }
995
- }
996
- }
997
- else {
998
- if (element.nodeName === 'BUTTON') {
999
- hide = false;
1000
- }
1001
- else {
1002
- disable = false;
1003
- }
1004
- }
1005
- }
1006
- else {
1007
- if (right === 'read') {
1008
- if (hide !== false) {
1009
- hide = true;
1010
- }
1011
- }
1012
- else if (element.nodeName === 'BUTTON') {
1013
- if (hide !== false) {
1014
- hide = true;
1015
- }
1016
- }
1017
- else if (disable !== false) {
1018
- disable = true;
1019
- }
1020
- }
1021
- }
1022
- });
1023
- console.log('hide: ', hide);
1024
- console.log('disable: ', disable);
1025
- if (hide === true) {
1026
- this.hideHtmlElement(element);
1027
- }
1028
- else if (disable === true) {
1029
- this.disableHtmlElement(element);
1030
- }
1031
- });
1032
- }
1033
- checkPermission(accessControlConfig) {
1034
- const selData = accessControlConfig.route.data;
1035
- this.loginStaff = selData.loginStaff;
1036
- this.selectedOffender = selData.selectedOffender;
1037
- let routePath = '';
1038
- if (accessControlConfig.route.url &&
1039
- accessControlConfig.route.url.length > 0) {
1040
- routePath = accessControlConfig.route.url[0].path;
1041
- }
1042
- const permissions = this.loginStaff.permissions;
1043
- const resource = routePath;
1044
- const roleId = accessControlConfig.roleId
1045
- ? accessControlConfig.roleId.toUpperCase()
1046
- : null;
1047
- const accessType = accessControlConfig.accessType;
1048
- const assignmentStaffRelationId = (!this.selectedOffender || !this.selectedOffender
1049
- .assignmentStaffRelationId)
1050
- ? 'N/A'
1051
- : this.selectedOffender.assignmentStaffRelationId;
1052
- const permission = permissions.find((p) => {
1053
- return (p.appModuleId === accessControlConfig.appModuleId &&
1054
- p.resource === resource &&
1055
- (!roleId || p.roleId === roleId) &&
1056
- (p.assignmentStaffRelationId === 'N/A' ||
1057
- p.assignmentStaffRelationId === assignmentStaffRelationId));
1058
- });
1059
- if (permission) {
1060
- if (accessType === 'read') {
1061
- if (!permission.readFlag) {
1062
- return false;
1063
- }
1064
- else {
1065
- return true;
1066
- }
1067
- }
1068
- else if ((accessType === 'create' && !permission.createFlag) ||
1069
- (accessType === 'update' && !permission.updateFlag) ||
1070
- (accessType === 'delete' && !permission.deleteFlag) ||
1071
- (accessType === 'assign' && !permission.assignFlag) ||
1072
- (accessType === 'close' && !permission.closeFlag) ||
1073
- (accessType === 'expunge' && !permission.expungeFlag) ||
1074
- (accessType === 'reopen' && !permission.reopenFlag)) {
1075
- return false;
1076
- }
1077
- else {
1078
- return true;
1079
- }
1080
- }
1081
- else {
1082
- if (accessType === 'read') {
1083
- return false;
1084
- }
1085
- }
1086
- return false;
1087
- }
1088
- canAppFeatureActivate(loginStaff, feature, appModuleId = null) {
1089
- // if (!this.isAuthEnable(loginStaff.roles, appModuleId)) {
1090
- // return true;
1091
- // }
1092
- return this.hasAppFeaturePermission(loginStaff.permissions, feature, appModuleId);
1093
- }
1094
- // public isAuthEnable(roles: Role[], appModuleId: string) {
1095
- // if (roles && roles.length > 0) {
1096
- // return roles.map(r => r.roleId).findIndex(this.isExternalRole) > -1 || appModuleId === 'RR';
1097
- // }
1098
- // return false;
1099
- // }
1100
- hasIntakeRole(roles) {
1101
- if (roles && roles.length > 0) {
1102
- return roles.findIndex(this.isIntakeRole) > -1;
1103
- }
1104
- return false;
1105
- }
1106
- hasAppFeaturePermission(permissions, feature, appModuleId) {
1107
- if (permissions && permissions.length > 0) {
1108
- if (appModuleId) {
1109
- return (permissions.findIndex((p) => p.resource === feature && p.appModuleId === appModuleId) > -1);
1110
- }
1111
- else {
1112
- return permissions.findIndex((p) => p.resource === feature) > -1;
1113
- }
1114
- }
1115
- return false;
1116
- }
1117
- isExternalRole(roleId) {
1118
- switch (roleId) {
1119
- case 'EUDTL':
1120
- case 'EUDUSM':
1121
- case 'EUJDG':
1122
- case 'EUMPD':
1123
- case 'EUSOTV':
1124
- case 'EUUSA2':
1125
- case 'EUUSAO':
1126
- case 'EUUSPC':
1127
- return true;
1128
- default:
1129
- return false;
1130
- }
1131
- }
1132
- isIntakeRole(role) {
1133
- switch (role.roleId) {
1134
- case 'OPA':
1135
- case 'OPS':
1136
- case 'SOPS':
1137
- return true;
1138
- default:
1139
- return false;
1140
- }
1141
- }
1142
- disableHtmlElement(element) {
1143
- // console.log(element);
1144
- switch (element.nodeName) {
1145
- case 'A':
1146
- element.setAttribute('style', 'pointer-events: none;cursor: not-allowed;');
1147
- element.setAttribute('tabIndex', '-1');
1148
- break;
1149
- default:
1150
- element.setAttribute('disabled', 'disabled');
1151
- break;
1152
- }
1153
- }
1154
- hideHtmlElement(element) {
1155
- // element.setAttribute('hidden', 'hidden');
1156
- element.setAttribute('style', 'display: none;');
1157
- }
1158
- getStaff(userName) {
1159
- return this.query({
1160
- query: this.findStaffQuery,
1161
- variables: {
1162
- input: {
1163
- where: {
1164
- userName: userName,
1165
- activeFlag: true,
1166
- },
1167
- }
1168
- },
1169
- }).pipe(take(1), map((result) => {
1170
- if (isDevMode) {
1171
- console.log('##### getStaff() from service ', result);
1172
- }
1173
- if (result.findvStaffs.data.length > 0) {
1174
- const data = result.findvStaffs.data[0];
1175
- this.xdmService.setLoginStaff(data);
1176
- this.loginStaff = data;
1177
- return data;
1178
- }
1179
- else {
1180
- return of(null);
1181
- }
1182
- }), catchError((error) => {
1183
- console.log('error ' + error);
1184
- return of(null);
1185
- }));
1186
- }
1187
- query(options) {
1188
- return this.http
1189
- .post(this.smartDataServiceUrl, {
1190
- query: options.query,
1191
- variables: options.variables,
1192
- }, {
1193
- headers: new HttpHeaders({
1194
- 'Content-Type': 'application/json',
1195
- 'No-Auth': 'True',
1196
- }),
1197
- })
1198
- .pipe(map((d) => d.data));
1199
- }
1200
- get findStaffQuery() {
1201
- return `
1202
- query findvStaffs($input: vStaffMultiInput) {
1203
- findvStaffs(input: $input) {
1204
- totalCount
1205
- message
1206
- data {
1207
- staffId
1208
- userName
1209
- lastName
1210
- firstName
1211
- phone
1212
- email
1213
- roles {
1214
- roleId
1215
- role
1216
- }
1217
- permissions {
1218
- roleId
1219
- appModuleId
1220
- resource
1221
- assignmentStaffRelationId
1222
- readFlag
1223
- createFlag
1224
- updateFlag
1225
- deleteFlag
1226
- assignFlag
1227
- reopenFlag
1228
- closeFlag
1229
- expungeFlag
1230
- }
1231
- options {
1232
- offenderListOptionId
1233
- name
1234
- serviceApiFieldName
1235
- selectedFlag
1236
- }
1237
- }
1238
- }
1239
- }
1240
- `;
1241
- }
1242
- getStaffOffenderRelation(staffId, offenderId) {
1243
- const queryString = `
1244
- {
1245
- findvStaffOffenderRelations(input: {where: {staffId: ${staffId}, offenderId: ${offenderId}}}) {
1246
- data {
1247
- assignmentStaffRelationId
1248
- }
1249
- }
1250
- }`;
1251
- return this.http
1252
- .post(this.smartDataServiceUrl, { query: queryString })
1253
- .pipe(take(1), map((result) => {
1254
- if (isDevMode) {
1255
- console.log('##### getStaffOffenderRelation() from service ', result);
1256
- }
1257
- if (result.data.findvStaffOffenderRelations.data.length > 0) {
1258
- const data = result.data.findvStaffOffenderRelations.data[0];
1259
- return data.assignmentStaffRelationId;
1260
- }
1261
- else {
1262
- return null;
1263
- // return throwError('No access right.');
1264
- }
1265
- }), catchError((error) => {
1266
- console.log('error ' + error);
1267
- return null;
1268
- }));
1269
- }
1270
- getRolePermissions(appModuleId, resource) {
1271
- const queryString = `
1272
- query findvRolePermissionPivots{
1273
- findvRolePermissionPivots(input: {where: {appModuleId: ${appModuleId}, resource: ${resource}}}){
1274
- totalCount
1275
- message
1276
- }
1277
- }`;
1278
- return this.http
1279
- .post(this.smartDataServiceUrl, { query: queryString })
1280
- .pipe(take(1), map((result) => {
1281
- if (isDevMode) {
1282
- console.log('##### findvRolePermissionPivots() from service ', result);
1283
- }
1284
- if (result.data.findvRolePermissionPivots.totalCount > 0) {
1285
- return true;
1286
- }
1287
- else {
1288
- return false;
1289
- // return throwError('No access right.');
1290
- }
1291
- }), catchError((error) => {
1292
- console.log('error ' + error);
1293
- return throwError(error);
1294
- }));
1295
- }
1296
- }
1297
- /** @nocollapse */ SmartAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, deps: [{ token: i1.HttpClient }, { token: i2.MsalService }, { token: XdmService }, { token: SMART_DATA_SERVICE_URL }, { token: SMART_DOMAIN_FORMAT }], target: i0.ɵɵFactoryTarget.Injectable });
1298
- /** @nocollapse */ SmartAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, providedIn: 'root' });
1299
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, decorators: [{
1300
- type: Injectable,
1301
- args: [{
1302
- providedIn: 'root',
1303
- }]
1304
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.MsalService }, { type: XdmService }, { type: undefined, decorators: [{
1305
- type: Inject,
1306
- args: [SMART_DATA_SERVICE_URL]
1307
- }] }, { type: undefined, decorators: [{
1308
- type: Inject,
1309
- args: [SMART_DOMAIN_FORMAT]
819
+ class SmartAuthService {
820
+ constructor(http, authnService, xdmService, smartDataServiceUrl, smartDomainFormatUrl) {
821
+ this.http = http;
822
+ this.authnService = authnService;
823
+ this.xdmService = xdmService;
824
+ this.smartDataServiceUrl = smartDataServiceUrl;
825
+ this.smartDomainFormatUrl = smartDomainFormatUrl;
826
+ }
827
+ getLoginStaff() {
828
+ if (isDevMode) {
829
+ console.log('SmartAuthService - getLoginStaff()');
830
+ }
831
+ if (!isDevMode && this.loginStaff) {
832
+ if (this.loginStaff.staffId) {
833
+ if (isDevMode) {
834
+ console.log('##### getLoginStaff(): get internal instance in service', this.loginStaff);
835
+ }
836
+ return of(this.loginStaff);
837
+ }
838
+ else if (this.loginStaff.userName) {
839
+ if (isDevMode) {
840
+ console.log('##### getLoginStaff(): get using preset user name', this.loginStaff);
841
+ }
842
+ return this.getStaff(this.loginStaff.userName);
843
+ }
844
+ }
845
+ return from(this.xdmService.getLoginStaff()).pipe(switchMap((storedResult) => {
846
+ if (storedResult && storedResult.staffId) {
847
+ if (isDevMode) {
848
+ console.log('##### getLoginStaff(): get from session.', storedResult);
849
+ }
850
+ this.loginStaff = storedResult;
851
+ return of(storedResult);
852
+ }
853
+ else if (storedResult && storedResult.userName) {
854
+ if (isDevMode) {
855
+ console.log('##### getLoginStaff(): get using preset user name', this.loginStaff);
856
+ }
857
+ return this.getStaff(storedResult.userName);
858
+ }
859
+ else {
860
+ const userName = this.userName;
861
+ const staffName = userName.substring(0, userName.indexOf('@'));
862
+ if (isDevMode) {
863
+ console.log('##### loginLoginStaff(): get using login staff name ', staffName);
864
+ }
865
+ return this.getStaff(staffName);
866
+ }
867
+ }));
868
+ }
869
+ get userName() {
870
+ if (this.authnService.instance.getAllAccounts().length > 0) {
871
+ const account = this.authnService.instance.getAllAccounts()[0];
872
+ return account.username;
873
+ }
874
+ return '';
875
+ }
876
+ getTeamUrl(app, afterHash) {
877
+ return this.smartDomainFormatUrl.replace('${APP}', app) + afterHash;
878
+ }
879
+ isSameHost(url, app) {
880
+ return this.smartDomainFormatUrl.replace('${APP}', app) === url;
881
+ }
882
+ redirectToTeam(loginStaff) {
883
+ if (loginStaff.roles.findIndex((role) => role.roleId === 'EUUSPC') > -1) {
884
+ if (!this.isSameHost(window.location.origin, 'investigation')) {
885
+ window.location.href = this.getTeamUrl('investigation', '/assignment');
886
+ }
887
+ }
888
+ else if (loginStaff.roles.findIndex((role) => role.roleId.substring(0, 3) === 'RSC') > -1) {
889
+ if (!this.isSameHost(window.location.origin, 'rsc')) {
890
+ window.location.href = this.getTeamUrl('rsc', '/offender-list');
891
+ }
892
+ }
893
+ }
894
+ async setSelectedOffender(selectedOffender) {
895
+ if (!this.loginStaff) {
896
+ return;
897
+ }
898
+ if (selectedOffender) {
899
+ // if (!selectedOffender.assignmentStaffRelationId) {
900
+ const relation = await lastValueFrom(this.getStaffOffenderRelation(this.loginStaff.staffId, selectedOffender.offenderId));
901
+ if (relation) {
902
+ selectedOffender.assignmentStaffRelationId = relation;
903
+ }
904
+ else {
905
+ selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
906
+ }
907
+ // }
908
+ }
909
+ this.xdmService.setSelectedOffender(selectedOffender);
910
+ this.selectedOffender = selectedOffender;
911
+ }
912
+ logout() {
913
+ this.xdmService.clearAll();
914
+ this.authnService.logout();
915
+ }
916
+ async setPermission(appModuleId, route) {
917
+ if (!this.loginStaff) {
918
+ this.loginStaff = await this.xdmService.getLoginStaff();
919
+ }
920
+ const permissions = this.loginStaff.permissions;
921
+ const resource = route.url && route.url.length > 0 ? route.url[0].path : '';
922
+ if (!this.selectedOffender) {
923
+ this.selectedOffender = await this.xdmService.getSelectedOffender();
924
+ }
925
+ if (this.selectedOffender) {
926
+ // if (!this.selectedOffender.assignmentStaffRelationId) {
927
+ const relation = await this.getStaffOffenderRelation(this.loginStaff.staffId, this.selectedOffender.offenderId).toPromise();
928
+ if (relation) {
929
+ this.selectedOffender.assignmentStaffRelationId = relation;
930
+ }
931
+ else {
932
+ this.selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
933
+ }
934
+ this.xdmService.setSelectedOffender(this.selectedOffender);
935
+ // }
936
+ }
937
+ const assignmentStaffRelationId = this.selectedOffender.assignmentStaffRelationId;
938
+ const elements = document.querySelectorAll('[class^="sac-"]');
939
+ const pattern = /^sac-(\S+)-(\S+)$/i;
940
+ Array.from(elements).forEach((element) => {
941
+ let hide;
942
+ let disable;
943
+ element.classList.forEach((c) => {
944
+ const results = c.match(pattern);
945
+ // console.log(results);
946
+ if (results && results.length > 2) {
947
+ const roleId = results[1] ? results[1].toUpperCase() : null;
948
+ const right = results[2];
949
+ // console.log(results[0]);
950
+ // console.log(results[1]);
951
+ // console.log(results[2]);
952
+ const permission = permissions.find(function (p) {
953
+ return (p.appModuleId === appModuleId &&
954
+ p.resource === resource &&
955
+ p.roleId === roleId &&
956
+ p.assignmentStaffRelationId === assignmentStaffRelationId);
957
+ });
958
+ /*
959
+ console.log('##### setPermission() resource: ', resource);
960
+ console.log('##### setPermission() appModuleId: ', appModuleId);
961
+ console.log('##### setPermission() roleId: ', roleId);
962
+ console.log(
963
+ '##### setPermission() assignment relation: ',
964
+ assignmentStaffRelationId,
965
+ );
966
+ */
967
+ console.log('##### Matched permission: ', permission);
968
+ if (permission) {
969
+ if (right === 'read') {
970
+ if (!permission.readFlag) {
971
+ if (hide !== false) {
972
+ hide = true;
973
+ }
974
+ }
975
+ else {
976
+ hide = false;
977
+ }
978
+ }
979
+ else if ((right === 'create' && !permission.createFlag) ||
980
+ (right === 'update' && !permission.updateFlag) ||
981
+ (right === 'delete' && !permission.deleteFlag) ||
982
+ (right === 'assign' && !permission.assignFlag) ||
983
+ (right === 'close' && !permission.closeFlag) ||
984
+ (right === 'expunge' && !permission.expungeFlag) ||
985
+ (right === 'reopen' && !permission.reopenFlag)) {
986
+ if (element.nodeName === 'BUTTON') {
987
+ if (hide !== false) {
988
+ hide = true;
989
+ }
990
+ }
991
+ else {
992
+ if (disable !== false) {
993
+ disable = true;
994
+ }
995
+ }
996
+ }
997
+ else {
998
+ if (element.nodeName === 'BUTTON') {
999
+ hide = false;
1000
+ }
1001
+ else {
1002
+ disable = false;
1003
+ }
1004
+ }
1005
+ }
1006
+ else {
1007
+ if (right === 'read') {
1008
+ if (hide !== false) {
1009
+ hide = true;
1010
+ }
1011
+ }
1012
+ else if (element.nodeName === 'BUTTON') {
1013
+ if (hide !== false) {
1014
+ hide = true;
1015
+ }
1016
+ }
1017
+ else if (disable !== false) {
1018
+ disable = true;
1019
+ }
1020
+ }
1021
+ }
1022
+ });
1023
+ console.log('hide: ', hide);
1024
+ console.log('disable: ', disable);
1025
+ if (hide === true) {
1026
+ this.hideHtmlElement(element);
1027
+ }
1028
+ else if (disable === true) {
1029
+ this.disableHtmlElement(element);
1030
+ }
1031
+ });
1032
+ }
1033
+ checkPermission(accessControlConfig) {
1034
+ const selData = accessControlConfig.route.data;
1035
+ this.loginStaff = selData.loginStaff;
1036
+ this.selectedOffender = selData.selectedOffender;
1037
+ let routePath = '';
1038
+ if (accessControlConfig.route.url &&
1039
+ accessControlConfig.route.url.length > 0) {
1040
+ routePath = accessControlConfig.route.url[0].path;
1041
+ }
1042
+ const permissions = this.loginStaff.permissions;
1043
+ const resource = routePath;
1044
+ const roleId = accessControlConfig.roleId
1045
+ ? accessControlConfig.roleId.toUpperCase()
1046
+ : null;
1047
+ const accessType = accessControlConfig.accessType;
1048
+ const assignmentStaffRelationId = (!this.selectedOffender || !this.selectedOffender
1049
+ .assignmentStaffRelationId)
1050
+ ? 'N/A'
1051
+ : this.selectedOffender.assignmentStaffRelationId;
1052
+ const permission = permissions.find((p) => {
1053
+ return (p.appModuleId === accessControlConfig.appModuleId &&
1054
+ p.resource === resource &&
1055
+ (!roleId || p.roleId === roleId) &&
1056
+ (p.assignmentStaffRelationId === 'N/A' ||
1057
+ p.assignmentStaffRelationId === assignmentStaffRelationId));
1058
+ });
1059
+ if (permission) {
1060
+ if (accessType === 'read') {
1061
+ if (!permission.readFlag) {
1062
+ return false;
1063
+ }
1064
+ else {
1065
+ return true;
1066
+ }
1067
+ }
1068
+ else if ((accessType === 'create' && !permission.createFlag) ||
1069
+ (accessType === 'update' && !permission.updateFlag) ||
1070
+ (accessType === 'delete' && !permission.deleteFlag) ||
1071
+ (accessType === 'assign' && !permission.assignFlag) ||
1072
+ (accessType === 'close' && !permission.closeFlag) ||
1073
+ (accessType === 'expunge' && !permission.expungeFlag) ||
1074
+ (accessType === 'reopen' && !permission.reopenFlag)) {
1075
+ return false;
1076
+ }
1077
+ else {
1078
+ return true;
1079
+ }
1080
+ }
1081
+ else {
1082
+ if (accessType === 'read') {
1083
+ return false;
1084
+ }
1085
+ }
1086
+ return false;
1087
+ }
1088
+ canAppFeatureActivate(loginStaff, feature, appModuleId = null) {
1089
+ // if (!this.isAuthEnable(loginStaff.roles, appModuleId)) {
1090
+ // return true;
1091
+ // }
1092
+ return this.hasAppFeaturePermission(loginStaff.permissions, feature, appModuleId);
1093
+ }
1094
+ // public isAuthEnable(roles: Role[], appModuleId: string) {
1095
+ // if (roles && roles.length > 0) {
1096
+ // return roles.map(r => r.roleId).findIndex(this.isExternalRole) > -1 || appModuleId === 'RR';
1097
+ // }
1098
+ // return false;
1099
+ // }
1100
+ hasIntakeRole(roles) {
1101
+ if (roles && roles.length > 0) {
1102
+ return roles.findIndex(this.isIntakeRole) > -1;
1103
+ }
1104
+ return false;
1105
+ }
1106
+ hasAppFeaturePermission(permissions, feature, appModuleId) {
1107
+ if (permissions && permissions.length > 0) {
1108
+ if (appModuleId) {
1109
+ return (permissions.findIndex((p) => p.resource === feature && p.appModuleId === appModuleId) > -1);
1110
+ }
1111
+ else {
1112
+ return permissions.findIndex((p) => p.resource === feature) > -1;
1113
+ }
1114
+ }
1115
+ return false;
1116
+ }
1117
+ isExternalRole(roleId) {
1118
+ switch (roleId) {
1119
+ case 'EUDTL':
1120
+ case 'EUDUSM':
1121
+ case 'EUJDG':
1122
+ case 'EUMPD':
1123
+ case 'EUSOTV':
1124
+ case 'EUUSA2':
1125
+ case 'EUUSAO':
1126
+ case 'EUUSPC':
1127
+ return true;
1128
+ default:
1129
+ return false;
1130
+ }
1131
+ }
1132
+ isIntakeRole(role) {
1133
+ switch (role.roleId) {
1134
+ case 'OPA':
1135
+ case 'OPS':
1136
+ case 'SOPS':
1137
+ return true;
1138
+ default:
1139
+ return false;
1140
+ }
1141
+ }
1142
+ disableHtmlElement(element) {
1143
+ // console.log(element);
1144
+ switch (element.nodeName) {
1145
+ case 'A':
1146
+ element.setAttribute('style', 'pointer-events: none;cursor: not-allowed;');
1147
+ element.setAttribute('tabIndex', '-1');
1148
+ break;
1149
+ default:
1150
+ element.setAttribute('disabled', 'disabled');
1151
+ break;
1152
+ }
1153
+ }
1154
+ hideHtmlElement(element) {
1155
+ // element.setAttribute('hidden', 'hidden');
1156
+ element.setAttribute('style', 'display: none;');
1157
+ }
1158
+ getStaff(userName) {
1159
+ return this.query({
1160
+ query: this.findStaffQuery,
1161
+ variables: {
1162
+ input: {
1163
+ where: {
1164
+ userName: userName,
1165
+ activeFlag: true,
1166
+ },
1167
+ }
1168
+ },
1169
+ }).pipe(take(1), map((result) => {
1170
+ if (isDevMode) {
1171
+ console.log('##### getStaff() from service ', result);
1172
+ }
1173
+ if (result.findvStaffs.data.length > 0) {
1174
+ const data = result.findvStaffs.data[0];
1175
+ this.xdmService.setLoginStaff(data);
1176
+ this.loginStaff = data;
1177
+ return data;
1178
+ }
1179
+ else {
1180
+ return of(null);
1181
+ }
1182
+ }), catchError((error) => {
1183
+ console.log('error ' + error);
1184
+ return of(null);
1185
+ }));
1186
+ }
1187
+ query(options) {
1188
+ return this.http
1189
+ .post(this.smartDataServiceUrl, {
1190
+ query: options.query,
1191
+ variables: options.variables,
1192
+ }, {
1193
+ headers: new HttpHeaders({
1194
+ 'Content-Type': 'application/json',
1195
+ 'No-Auth': 'True',
1196
+ }),
1197
+ })
1198
+ .pipe(map((d) => d.data));
1199
+ }
1200
+ get findStaffQuery() {
1201
+ return `
1202
+ query findvStaffs($input: vStaffMultiInput) {
1203
+ findvStaffs(input: $input) {
1204
+ totalCount
1205
+ message
1206
+ data {
1207
+ staffId
1208
+ userName
1209
+ lastName
1210
+ firstName
1211
+ phone
1212
+ email
1213
+ roles {
1214
+ roleId
1215
+ role
1216
+ }
1217
+ permissions {
1218
+ roleId
1219
+ appModuleId
1220
+ resource
1221
+ assignmentStaffRelationId
1222
+ readFlag
1223
+ createFlag
1224
+ updateFlag
1225
+ deleteFlag
1226
+ assignFlag
1227
+ reopenFlag
1228
+ closeFlag
1229
+ expungeFlag
1230
+ }
1231
+ options {
1232
+ offenderListOptionId
1233
+ name
1234
+ serviceApiFieldName
1235
+ selectedFlag
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ `;
1241
+ }
1242
+ getStaffOffenderRelation(staffId, offenderId) {
1243
+ const queryString = `
1244
+ {
1245
+ findvStaffOffenderRelations(input: {where: {staffId: ${staffId}, offenderId: ${offenderId}}}) {
1246
+ data {
1247
+ assignmentStaffRelationId
1248
+ }
1249
+ }
1250
+ }`;
1251
+ return this.http
1252
+ .post(this.smartDataServiceUrl, { query: queryString })
1253
+ .pipe(take(1), map((result) => {
1254
+ if (isDevMode) {
1255
+ console.log('##### getStaffOffenderRelation() from service ', result);
1256
+ }
1257
+ if (result.data.findvStaffOffenderRelations.data.length > 0) {
1258
+ const data = result.data.findvStaffOffenderRelations.data[0];
1259
+ return data.assignmentStaffRelationId;
1260
+ }
1261
+ else {
1262
+ return null;
1263
+ // return throwError('No access right.');
1264
+ }
1265
+ }), catchError((error) => {
1266
+ console.log('error ' + error);
1267
+ return null;
1268
+ }));
1269
+ }
1270
+ getRolePermissions(appModuleId, resource) {
1271
+ const queryString = `
1272
+ query findvRolePermissionPivots{
1273
+ findvRolePermissionPivots(input: {where: {appModuleId: ${appModuleId}, resource: ${resource}}}){
1274
+ totalCount
1275
+ message
1276
+ }
1277
+ }`;
1278
+ return this.http
1279
+ .post(this.smartDataServiceUrl, { query: queryString })
1280
+ .pipe(take(1), map((result) => {
1281
+ if (isDevMode) {
1282
+ console.log('##### findvRolePermissionPivots() from service ', result);
1283
+ }
1284
+ if (result.data.findvRolePermissionPivots.totalCount > 0) {
1285
+ return true;
1286
+ }
1287
+ else {
1288
+ return false;
1289
+ // return throwError('No access right.');
1290
+ }
1291
+ }), catchError((error) => {
1292
+ console.log('error ' + error);
1293
+ return throwError(error);
1294
+ }));
1295
+ }
1296
+ }
1297
+ /** @nocollapse */ SmartAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, deps: [{ token: i1.HttpClient }, { token: i2.MsalService }, { token: XdmService }, { token: SMART_DATA_SERVICE_URL }, { token: SMART_DOMAIN_FORMAT }], target: i0.ɵɵFactoryTarget.Injectable });
1298
+ /** @nocollapse */ SmartAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, providedIn: 'root' });
1299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthService, decorators: [{
1300
+ type: Injectable,
1301
+ args: [{
1302
+ providedIn: 'root',
1303
+ }]
1304
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.MsalService }, { type: XdmService }, { type: undefined, decorators: [{
1305
+ type: Inject,
1306
+ args: [SMART_DATA_SERVICE_URL]
1307
+ }] }, { type: undefined, decorators: [{
1308
+ type: Inject,
1309
+ args: [SMART_DOMAIN_FORMAT]
1310
1310
  }] }]; } });
1311
1311
 
1312
- class SmartAccessControlDirective {
1313
- constructor(elementRef, auth) {
1314
- this.elementRef = elementRef;
1315
- this.auth = auth;
1316
- }
1317
- ngOnInit() {
1318
- this.checkAccess();
1319
- }
1320
- checkAccess() {
1321
- if (!this.accessControlConfig ||
1322
- !this.accessControlConfig.route ||
1323
- !this.accessControlConfig.route.data ||
1324
- !this.accessControlConfig.route.data.loginStaff) {
1325
- return;
1326
- }
1327
- // const loginStaff = this.accessControlConfig.route.data.loginStaff;
1328
- // if (!this.auth.isAuthEnable(loginStaff.roles, this.accessControlConfig.appModuleId)) {
1329
- // return;
1330
- // }
1331
- this.elementRef.nativeElement.style.display = this.auth.checkPermission(this.accessControlConfig)
1332
- ? 'block'
1333
- : 'none';
1334
- }
1335
- }
1336
- /** @nocollapse */ SmartAccessControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAccessControlDirective, deps: [{ token: i0.ElementRef }, { token: SmartAuthService }], target: i0.ɵɵFactoryTarget.Directive });
1337
- /** @nocollapse */ SmartAccessControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: SmartAccessControlDirective, selector: "[accessControl]", inputs: { accessControlConfig: "accessControlConfig" }, ngImport: i0 });
1338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAccessControlDirective, decorators: [{
1339
- type: Directive,
1340
- args: [{
1341
- selector: '[accessControl]',
1342
- }]
1343
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SmartAuthService }]; }, propDecorators: { accessControlConfig: [{
1344
- type: Input
1312
+ class SmartAccessControlDirective {
1313
+ constructor(elementRef, auth) {
1314
+ this.elementRef = elementRef;
1315
+ this.auth = auth;
1316
+ }
1317
+ ngOnInit() {
1318
+ this.checkAccess();
1319
+ }
1320
+ checkAccess() {
1321
+ if (!this.accessControlConfig ||
1322
+ !this.accessControlConfig.route ||
1323
+ !this.accessControlConfig.route.data ||
1324
+ !this.accessControlConfig.route.data.loginStaff) {
1325
+ return;
1326
+ }
1327
+ // const loginStaff = this.accessControlConfig.route.data.loginStaff;
1328
+ // if (!this.auth.isAuthEnable(loginStaff.roles, this.accessControlConfig.appModuleId)) {
1329
+ // return;
1330
+ // }
1331
+ this.elementRef.nativeElement.style.display = this.auth.checkPermission(this.accessControlConfig)
1332
+ ? 'block'
1333
+ : 'none';
1334
+ }
1335
+ }
1336
+ /** @nocollapse */ SmartAccessControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAccessControlDirective, deps: [{ token: i0.ElementRef }, { token: SmartAuthService }], target: i0.ɵɵFactoryTarget.Directive });
1337
+ /** @nocollapse */ SmartAccessControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: SmartAccessControlDirective, selector: "[accessControl]", inputs: { accessControlConfig: "accessControlConfig" }, ngImport: i0 });
1338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAccessControlDirective, decorators: [{
1339
+ type: Directive,
1340
+ args: [{
1341
+ selector: '[accessControl]',
1342
+ }]
1343
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SmartAuthService }]; }, propDecorators: { accessControlConfig: [{
1344
+ type: Input
1345
1345
  }] } });
1346
1346
 
1347
- // smart-authorization.service
1348
- class SmartAuthorizationGuard {
1349
- constructor(authnService) {
1350
- this.authnService = authnService;
1351
- }
1352
- canActivate(route) {
1353
- return this.authnService.getLoginStaff().pipe(take(1), mergeMap((loginStaff) => {
1354
- if (!loginStaff || !route || !route.routeConfig) {
1355
- return of(false);
1356
- }
1357
- // if (!this.authnService.isAuthEnable(loginStaff.roles, null)) {
1358
- // return of(true);
1359
- // }
1360
- const resource = route.routeConfig.path
1361
- ? route.routeConfig.path.split('/')[0]
1362
- : '';
1363
- const isFeatureValid = this.authnService.canAppFeatureActivate(loginStaff, resource);
1364
- return of(isFeatureValid);
1365
- }), catchError((error) => {
1366
- return of(false);
1367
- }));
1368
- }
1369
- }
1370
- /** @nocollapse */ SmartAuthorizationGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard, deps: [{ token: SmartAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
1371
- /** @nocollapse */ SmartAuthorizationGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard });
1372
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard, decorators: [{
1373
- type: Injectable
1347
+ // smart-authorization.service
1348
+ class SmartAuthorizationGuard {
1349
+ constructor(authnService) {
1350
+ this.authnService = authnService;
1351
+ }
1352
+ canActivate(route) {
1353
+ return this.authnService.getLoginStaff().pipe(take(1), mergeMap((loginStaff) => {
1354
+ if (!loginStaff || !route || !route.routeConfig) {
1355
+ return of(false);
1356
+ }
1357
+ // if (!this.authnService.isAuthEnable(loginStaff.roles, null)) {
1358
+ // return of(true);
1359
+ // }
1360
+ const resource = route.routeConfig.path
1361
+ ? route.routeConfig.path.split('/')[0]
1362
+ : '';
1363
+ const isFeatureValid = this.authnService.canAppFeatureActivate(loginStaff, resource);
1364
+ return of(isFeatureValid);
1365
+ }), catchError((error) => {
1366
+ return of(false);
1367
+ }));
1368
+ }
1369
+ }
1370
+ /** @nocollapse */ SmartAuthorizationGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard, deps: [{ token: SmartAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
1371
+ /** @nocollapse */ SmartAuthorizationGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard });
1372
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartAuthorizationGuard, decorators: [{
1373
+ type: Injectable
1374
1374
  }], ctorParameters: function () { return [{ type: SmartAuthService }]; } });
1375
1375
 
1376
- class NgcSmartCoreModule {
1377
- }
1378
- /** @nocollapse */ NgcSmartCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1379
- /** @nocollapse */ NgcSmartCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, declarations: [SmartOffenderHeaderComponent,
1380
- SmartNavbarComponent,
1381
- SmartErrorComponent,
1382
- SmartStaffOffenderOptionsComponent,
1383
- SmartAccessControlDirective], imports: [CommonModule,
1384
- HttpClientModule,
1385
- MatButtonModule,
1386
- MatMenuModule,
1387
- MatTabsModule,
1388
- MatSelectModule,
1389
- MatCardModule,
1390
- MatCheckboxModule,
1391
- ReactiveFormsModule], exports: [SmartOffenderHeaderComponent,
1392
- SmartNavbarComponent,
1393
- SmartErrorComponent,
1394
- SmartStaffOffenderOptionsComponent,
1395
- SmartAccessControlDirective] });
1396
- /** @nocollapse */ NgcSmartCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, providers: [
1397
- SmartNavbarService,
1398
- SmartOffenderHeaderService,
1399
- SmartStaffOffenderOptionsService,
1400
- SmartAuthorizationGuard,
1401
- MatSnackBar,
1402
- ], imports: [CommonModule,
1403
- HttpClientModule,
1404
- MatButtonModule,
1405
- MatMenuModule,
1406
- MatTabsModule,
1407
- MatSelectModule,
1408
- MatCardModule,
1409
- MatCheckboxModule,
1410
- ReactiveFormsModule] });
1411
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, decorators: [{
1412
- type: NgModule,
1413
- args: [{
1414
- declarations: [
1415
- SmartOffenderHeaderComponent,
1416
- SmartNavbarComponent,
1417
- SmartErrorComponent,
1418
- SmartStaffOffenderOptionsComponent,
1419
- SmartAccessControlDirective,
1420
- ],
1421
- imports: [
1422
- CommonModule,
1423
- HttpClientModule,
1424
- MatButtonModule,
1425
- MatMenuModule,
1426
- MatTabsModule,
1427
- MatSelectModule,
1428
- MatCardModule,
1429
- MatCheckboxModule,
1430
- ReactiveFormsModule,
1431
- ],
1432
- exports: [
1433
- SmartOffenderHeaderComponent,
1434
- SmartNavbarComponent,
1435
- SmartErrorComponent,
1436
- SmartStaffOffenderOptionsComponent,
1437
- SmartAccessControlDirective,
1438
- ],
1439
- providers: [
1440
- SmartNavbarService,
1441
- SmartOffenderHeaderService,
1442
- SmartStaffOffenderOptionsService,
1443
- SmartAuthorizationGuard,
1444
- MatSnackBar,
1445
- ],
1446
- }]
1376
+ class NgcSmartCoreModule {
1377
+ }
1378
+ /** @nocollapse */ NgcSmartCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1379
+ /** @nocollapse */ NgcSmartCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, declarations: [SmartOffenderHeaderComponent,
1380
+ SmartNavbarComponent,
1381
+ SmartErrorComponent,
1382
+ SmartStaffOffenderOptionsComponent,
1383
+ SmartAccessControlDirective], imports: [CommonModule,
1384
+ HttpClientModule,
1385
+ MatButtonModule,
1386
+ MatMenuModule,
1387
+ MatTabsModule,
1388
+ MatSelectModule,
1389
+ MatCardModule,
1390
+ MatCheckboxModule,
1391
+ ReactiveFormsModule], exports: [SmartOffenderHeaderComponent,
1392
+ SmartNavbarComponent,
1393
+ SmartErrorComponent,
1394
+ SmartStaffOffenderOptionsComponent,
1395
+ SmartAccessControlDirective] });
1396
+ /** @nocollapse */ NgcSmartCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, providers: [
1397
+ SmartNavbarService,
1398
+ SmartOffenderHeaderService,
1399
+ SmartStaffOffenderOptionsService,
1400
+ SmartAuthorizationGuard,
1401
+ MatSnackBar,
1402
+ ], imports: [CommonModule,
1403
+ HttpClientModule,
1404
+ MatButtonModule,
1405
+ MatMenuModule,
1406
+ MatTabsModule,
1407
+ MatSelectModule,
1408
+ MatCardModule,
1409
+ MatCheckboxModule,
1410
+ ReactiveFormsModule] });
1411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgcSmartCoreModule, decorators: [{
1412
+ type: NgModule,
1413
+ args: [{
1414
+ declarations: [
1415
+ SmartOffenderHeaderComponent,
1416
+ SmartNavbarComponent,
1417
+ SmartErrorComponent,
1418
+ SmartStaffOffenderOptionsComponent,
1419
+ SmartAccessControlDirective,
1420
+ ],
1421
+ imports: [
1422
+ CommonModule,
1423
+ HttpClientModule,
1424
+ MatButtonModule,
1425
+ MatMenuModule,
1426
+ MatTabsModule,
1427
+ MatSelectModule,
1428
+ MatCardModule,
1429
+ MatCheckboxModule,
1430
+ ReactiveFormsModule,
1431
+ ],
1432
+ exports: [
1433
+ SmartOffenderHeaderComponent,
1434
+ SmartNavbarComponent,
1435
+ SmartErrorComponent,
1436
+ SmartStaffOffenderOptionsComponent,
1437
+ SmartAccessControlDirective,
1438
+ ],
1439
+ providers: [
1440
+ SmartNavbarService,
1441
+ SmartOffenderHeaderService,
1442
+ SmartStaffOffenderOptionsService,
1443
+ SmartAuthorizationGuard,
1444
+ MatSnackBar,
1445
+ ],
1446
+ }]
1447
1447
  }] });
1448
1448
 
1449
- class LoginStaffResolverService {
1450
- constructor(authnService,
1451
- // private zone: NgZone,
1452
- router) {
1453
- this.authnService = authnService;
1454
- this.router = router;
1455
- }
1456
- resolve(route, state) {
1457
- return this.authnService.getLoginStaff().pipe(take(1), mergeMap((loginStaff) => {
1458
- if (isDevMode) {
1459
- console.log('LoginStaffResolverService: ', loginStaff);
1460
- }
1461
- if (loginStaff) {
1462
- return of(loginStaff);
1463
- }
1464
- else {
1465
- return throwError('Not authorized to access SMART.');
1466
- // return EMPTY;
1467
- /*
1468
- this.zone.run(() => {
1469
- this.router.navigate(['/smart-error'], {
1470
- queryParams: {
1471
- type: 'staff',
1472
- message: 'Not authorized to access SMART.'
1473
- }
1474
- });
1475
- });
1476
- return EMPTY;
1477
- */
1478
- }
1479
- }), catchError((error) => {
1480
- console.log('LoginStaffResolverService: ' + error);
1481
- this.router.navigate(['/smart-error'], {
1482
- queryParams: {
1483
- type: 'staff',
1484
- message: 'SMART Authentication: ' + error,
1485
- },
1486
- });
1487
- return EMPTY;
1488
- }));
1489
- }
1490
- }
1491
- /** @nocollapse */ LoginStaffResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, deps: [{ token: SmartAuthService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1492
- /** @nocollapse */ LoginStaffResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, providedIn: 'root' });
1493
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, decorators: [{
1494
- type: Injectable,
1495
- args: [{
1496
- providedIn: 'root',
1497
- }]
1449
+ class LoginStaffResolverService {
1450
+ constructor(authnService,
1451
+ // private zone: NgZone,
1452
+ router) {
1453
+ this.authnService = authnService;
1454
+ this.router = router;
1455
+ }
1456
+ resolve(route, state) {
1457
+ return this.authnService.getLoginStaff().pipe(take(1), mergeMap((loginStaff) => {
1458
+ if (isDevMode) {
1459
+ console.log('LoginStaffResolverService: ', loginStaff);
1460
+ }
1461
+ if (loginStaff) {
1462
+ return of(loginStaff);
1463
+ }
1464
+ else {
1465
+ return throwError('Not authorized to access SMART.');
1466
+ // return EMPTY;
1467
+ /*
1468
+ this.zone.run(() => {
1469
+ this.router.navigate(['/smart-error'], {
1470
+ queryParams: {
1471
+ type: 'staff',
1472
+ message: 'Not authorized to access SMART.'
1473
+ }
1474
+ });
1475
+ });
1476
+ return EMPTY;
1477
+ */
1478
+ }
1479
+ }), catchError((error) => {
1480
+ console.log('LoginStaffResolverService: ' + error);
1481
+ this.router.navigate(['/smart-error'], {
1482
+ queryParams: {
1483
+ type: 'staff',
1484
+ message: 'SMART Authentication: ' + error,
1485
+ },
1486
+ });
1487
+ return EMPTY;
1488
+ }));
1489
+ }
1490
+ }
1491
+ /** @nocollapse */ LoginStaffResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, deps: [{ token: SmartAuthService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1492
+ /** @nocollapse */ LoginStaffResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, providedIn: 'root' });
1493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LoginStaffResolverService, decorators: [{
1494
+ type: Injectable,
1495
+ args: [{
1496
+ providedIn: 'root',
1497
+ }]
1498
1498
  }], ctorParameters: function () { return [{ type: SmartAuthService }, { type: i2$1.Router }]; } });
1499
1499
 
1500
- class SelectedOffenderResolverService {
1501
- constructor(service, zone, router) {
1502
- this.service = service;
1503
- this.zone = zone;
1504
- this.router = router;
1505
- }
1506
- resolve(route, state) {
1507
- return from(this.service.getSelectedOffender()).pipe(mergeMap((selectedOffender) => {
1508
- if (isDevMode) {
1509
- console.log(selectedOffender);
1510
- }
1511
- if (!selectedOffender) {
1512
- return throwError('No offender selected.');
1513
- }
1514
- return of(selectedOffender);
1515
- }), retryWhen((errors) => errors.pipe(
1516
- // tap(() => console.log('Retry getting selected offender.')),
1517
- delay(1000), take(5), (o) => concat(o, throwError('No offender selected (failed after retries).')))), catchError((error) => {
1518
- /*
1519
- this.zone.run(() => {
1520
- this.router.navigate(['/smart-error'], {
1521
- queryParams: { type: 'offender', message: error }
1522
- });
1523
- });
1524
- */
1525
- this.router.navigate(['/smart-error'], {
1526
- queryParams: { type: 'offender', message: error },
1527
- });
1528
- return EMPTY;
1529
- }));
1530
- }
1531
- }
1532
- /** @nocollapse */ SelectedOffenderResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, deps: [{ token: XdmService }, { token: i0.NgZone }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1533
- /** @nocollapse */ SelectedOffenderResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, providedIn: 'root' });
1534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, decorators: [{
1535
- type: Injectable,
1536
- args: [{
1537
- providedIn: 'root',
1538
- }]
1500
+ class SelectedOffenderResolverService {
1501
+ constructor(service, zone, router) {
1502
+ this.service = service;
1503
+ this.zone = zone;
1504
+ this.router = router;
1505
+ }
1506
+ resolve(route, state) {
1507
+ return from(this.service.getSelectedOffender()).pipe(mergeMap((selectedOffender) => {
1508
+ if (isDevMode) {
1509
+ console.log(selectedOffender);
1510
+ }
1511
+ if (!selectedOffender) {
1512
+ return throwError('No offender selected.');
1513
+ }
1514
+ return of(selectedOffender);
1515
+ }), retryWhen((errors) => errors.pipe(
1516
+ // tap(() => console.log('Retry getting selected offender.')),
1517
+ delay(1000), take(5), (o) => concat(o, throwError('No offender selected (failed after retries).')))), catchError((error) => {
1518
+ /*
1519
+ this.zone.run(() => {
1520
+ this.router.navigate(['/smart-error'], {
1521
+ queryParams: { type: 'offender', message: error }
1522
+ });
1523
+ });
1524
+ */
1525
+ this.router.navigate(['/smart-error'], {
1526
+ queryParams: { type: 'offender', message: error },
1527
+ });
1528
+ return EMPTY;
1529
+ }));
1530
+ }
1531
+ }
1532
+ /** @nocollapse */ SelectedOffenderResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, deps: [{ token: XdmService }, { token: i0.NgZone }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1533
+ /** @nocollapse */ SelectedOffenderResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, providedIn: 'root' });
1534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SelectedOffenderResolverService, decorators: [{
1535
+ type: Injectable,
1536
+ args: [{
1537
+ providedIn: 'root',
1538
+ }]
1539
1539
  }], ctorParameters: function () { return [{ type: XdmService }, { type: i0.NgZone }, { type: i2$1.Router }]; } });
1540
1540
 
1541
- class SmartStaffOffenderOptionsResolverService {
1542
- constructor(offenderService) {
1543
- this.offenderService = offenderService;
1544
- }
1545
- resolve() {
1546
- return this.offenderService.getOffenderListOptions()
1547
- .pipe(map(({ data }) => {
1548
- return data;
1549
- }));
1550
- }
1551
- }
1552
- /** @nocollapse */ SmartStaffOffenderOptionsResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, deps: [{ token: SmartStaffOffenderOptionsService }], target: i0.ɵɵFactoryTarget.Injectable });
1553
- /** @nocollapse */ SmartStaffOffenderOptionsResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, providedIn: 'root' });
1554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, decorators: [{
1555
- type: Injectable,
1556
- args: [{
1557
- providedIn: 'root',
1558
- }]
1541
+ class SmartStaffOffenderOptionsResolverService {
1542
+ constructor(offenderService) {
1543
+ this.offenderService = offenderService;
1544
+ }
1545
+ resolve() {
1546
+ return this.offenderService.getOffenderListOptions()
1547
+ .pipe(map(({ data }) => {
1548
+ return data;
1549
+ }));
1550
+ }
1551
+ }
1552
+ /** @nocollapse */ SmartStaffOffenderOptionsResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, deps: [{ token: SmartStaffOffenderOptionsService }], target: i0.ɵɵFactoryTarget.Injectable });
1553
+ /** @nocollapse */ SmartStaffOffenderOptionsResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, providedIn: 'root' });
1554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmartStaffOffenderOptionsResolverService, decorators: [{
1555
+ type: Injectable,
1556
+ args: [{
1557
+ providedIn: 'root',
1558
+ }]
1559
1559
  }], ctorParameters: function () { return [{ type: SmartStaffOffenderOptionsService }]; } });
1560
1560
 
1561
- var AccessType;
1562
- (function (AccessType) {
1563
- AccessType["READ"] = "read";
1564
- AccessType["CREATE"] = "create";
1565
- AccessType["UPDATE"] = "update";
1566
- AccessType["DELETE"] = "delete";
1567
- AccessType["EXPUNGE"] = "expunge";
1568
- AccessType["ASSIGN"] = "assign";
1569
- AccessType["REOPEN"] = "reopen";
1570
- AccessType["CLOSE"] = "close";
1561
+ var AccessType;
1562
+ (function (AccessType) {
1563
+ AccessType["READ"] = "read";
1564
+ AccessType["CREATE"] = "create";
1565
+ AccessType["UPDATE"] = "update";
1566
+ AccessType["DELETE"] = "delete";
1567
+ AccessType["EXPUNGE"] = "expunge";
1568
+ AccessType["ASSIGN"] = "assign";
1569
+ AccessType["REOPEN"] = "reopen";
1570
+ AccessType["CLOSE"] = "close";
1571
1571
  })(AccessType || (AccessType = {}));
1572
1572
 
1573
- /*
1574
- * Public API Surface of ngc-smart-core
1573
+ /*
1574
+ * Public API Surface of ngc-smart-core
1575
1575
  */
1576
1576
 
1577
- /**
1578
- * Generated bundle index. Do not edit.
1577
+ /**
1578
+ * Generated bundle index. Do not edit.
1579
1579
  */
1580
1580
 
1581
1581
  export { AccessType, LoginStaff, LoginStaffResolverService, NgcSmartCoreModule, OffenderQuery, Option, Permission, Role, SMART_DATA_SERVICE_URL, SMART_DOMAIN_FORMAT, SMART_WEB_PORTAL_URL, SMART_WEB_STORAGE_LISTENER_URL, SelectedOffender, SelectedOffenderResolverService, SmartAccessControlDirective, SmartAuthService, SmartAuthorizationGuard, SmartErrorComponent, SmartNavbarComponent, SmartNavbarService, SmartOffenderHeaderComponent, SmartStaffOffenderOptionsComponent, SmartStaffOffenderOptionsResolverService, StorageKey, XdmService };