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