@hmcts/ccd-case-ui-toolkit 7.1.1-query-management → 7.1.2-query-management
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/esm2022/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +9 -10
- package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +17 -15
- package/esm2022/lib/shared/components/case-editor/services/cases.service.mjs +53 -27
- package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +13 -6
- package/esm2022/lib/shared/components/case-editor/services/work-allocation.service.mjs +9 -3
- package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +13 -5
- package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +11 -3
- package/esm2022/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.mjs +2 -1
- package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
- package/esm2022/lib/shared/services/fields/fields.utils.mjs +8 -1
- package/esm2022/lib/shared/services/profile/profile.service.mjs +2 -1
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +117 -51
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts +1 -2
- package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts +2 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts +1 -0
- package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/work-allocation.service.d.ts.map +1 -1
- package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
- package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
- package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
- package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts.map +1 -1
- package/lib/shared/domain/work-allocation/Task.d.ts +4 -0
- package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.utils.d.ts +2 -0
- package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4341,6 +4341,13 @@ class FieldsUtils {
|
|
|
4341
4341
|
return '';
|
|
4342
4342
|
}
|
|
4343
4343
|
}
|
|
4344
|
+
static getUserTaskFromClientContext(clientContextStr) {
|
|
4345
|
+
if (clientContextStr) {
|
|
4346
|
+
let clientContext = JSON.parse(clientContextStr);
|
|
4347
|
+
return clientContext.client_context.user_task;
|
|
4348
|
+
}
|
|
4349
|
+
return null;
|
|
4350
|
+
}
|
|
4344
4351
|
buildCanShowPredicate(eventTrigger, form) {
|
|
4345
4352
|
const currentState = this.getCurrentEventState(eventTrigger, form);
|
|
4346
4353
|
return (page) => {
|
|
@@ -7177,6 +7184,7 @@ class ProfileService {
|
|
|
7177
7184
|
.set('experimental', 'true')
|
|
7178
7185
|
.set('Accept', ProfileService.V2_MEDIATYPE_USER_PROFILE)
|
|
7179
7186
|
.set('Content-Type', 'application/json');
|
|
7187
|
+
// Not adding client context header because header is added to call immediately afterwards
|
|
7180
7188
|
return this.httpService
|
|
7181
7189
|
.get(url, { headers, observe: 'body' })
|
|
7182
7190
|
.pipe(map((p) => plainToClass(Profile, p)));
|
|
@@ -8073,6 +8081,7 @@ class CasesService {
|
|
|
8073
8081
|
let headers = new HttpHeaders();
|
|
8074
8082
|
headers = headers.set('experimental', 'true');
|
|
8075
8083
|
headers = headers.set('Content-Type', 'application/json');
|
|
8084
|
+
headers = this.addClientContextHeader(headers);
|
|
8076
8085
|
if (Draft.isDraft(caseId)) {
|
|
8077
8086
|
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
|
|
8078
8087
|
}
|
|
@@ -8083,9 +8092,10 @@ class CasesService {
|
|
|
8083
8092
|
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
|
|
8084
8093
|
}
|
|
8085
8094
|
return this.http
|
|
8086
|
-
.get(url, { headers, observe: '
|
|
8087
|
-
.pipe(map(
|
|
8088
|
-
|
|
8095
|
+
.get(url, { headers, observe: 'response' })
|
|
8096
|
+
.pipe(map((response) => {
|
|
8097
|
+
this.updateClientContextStorage(response.headers);
|
|
8098
|
+
return FieldsUtils.handleNestedDynamicLists(response.body);
|
|
8089
8099
|
}), catchError(error => {
|
|
8090
8100
|
this.errorService.setError(error);
|
|
8091
8101
|
return throwError(error);
|
|
@@ -8094,13 +8104,17 @@ class CasesService {
|
|
|
8094
8104
|
createEvent(caseDetails, eventData) {
|
|
8095
8105
|
const caseId = caseDetails.case_id;
|
|
8096
8106
|
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
|
|
8097
|
-
|
|
8107
|
+
let headers = new HttpHeaders()
|
|
8098
8108
|
.set('experimental', 'true')
|
|
8099
8109
|
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
|
|
8100
8110
|
.set('Content-Type', 'application/json');
|
|
8111
|
+
headers = this.addClientContextHeader(headers);
|
|
8101
8112
|
return this.http
|
|
8102
|
-
.post(url, eventData, { headers, observe: '
|
|
8103
|
-
.pipe(
|
|
8113
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
8114
|
+
.pipe(map((response) => {
|
|
8115
|
+
this.updateClientContextStorage(response.headers);
|
|
8116
|
+
return response.body;
|
|
8117
|
+
}), catchError(error => {
|
|
8104
8118
|
this.errorService.setError(error);
|
|
8105
8119
|
return throwError(error);
|
|
8106
8120
|
}));
|
|
@@ -8108,13 +8122,17 @@ class CasesService {
|
|
|
8108
8122
|
validateCase(ctid, eventData, pageId) {
|
|
8109
8123
|
const pageIdString = pageId ? `?pageId=${pageId}` : '';
|
|
8110
8124
|
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
|
|
8111
|
-
|
|
8125
|
+
let headers = new HttpHeaders()
|
|
8112
8126
|
.set('experimental', 'true')
|
|
8113
8127
|
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
|
|
8114
8128
|
.set('Content-Type', 'application/json');
|
|
8129
|
+
headers = this.addClientContextHeader(headers);
|
|
8115
8130
|
return this.http
|
|
8116
|
-
.post(url, eventData, { headers, observe: '
|
|
8117
|
-
.pipe(
|
|
8131
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
8132
|
+
.pipe(map((response) => {
|
|
8133
|
+
this.updateClientContextStorage(response.headers);
|
|
8134
|
+
return response.body;
|
|
8135
|
+
}), catchError(error => {
|
|
8118
8136
|
this.errorService.setError(error);
|
|
8119
8137
|
return throwError(error);
|
|
8120
8138
|
}));
|
|
@@ -8125,26 +8143,34 @@ class CasesService {
|
|
|
8125
8143
|
ignoreWarning = 'true';
|
|
8126
8144
|
}
|
|
8127
8145
|
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
|
|
8128
|
-
|
|
8146
|
+
let headers = new HttpHeaders()
|
|
8129
8147
|
.set('experimental', 'true')
|
|
8130
8148
|
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
|
|
8131
8149
|
.set('Content-Type', 'application/json');
|
|
8150
|
+
headers = this.addClientContextHeader(headers);
|
|
8132
8151
|
return this.http
|
|
8133
|
-
.post(url, eventData, { headers, observe: '
|
|
8134
|
-
.pipe(
|
|
8152
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
8153
|
+
.pipe(map((response) => {
|
|
8154
|
+
this.updateClientContextStorage(response.headers);
|
|
8155
|
+
return response.body;
|
|
8156
|
+
}), catchError(error => {
|
|
8135
8157
|
this.errorService.setError(error);
|
|
8136
8158
|
return throwError(error);
|
|
8137
8159
|
}));
|
|
8138
8160
|
}
|
|
8139
8161
|
getPrintDocuments(caseId) {
|
|
8140
8162
|
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
|
|
8141
|
-
|
|
8163
|
+
let headers = new HttpHeaders()
|
|
8142
8164
|
.set('experimental', 'true')
|
|
8143
8165
|
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
|
|
8144
8166
|
.set('Content-Type', 'application/json');
|
|
8167
|
+
headers = this.addClientContextHeader(headers);
|
|
8145
8168
|
return this.http
|
|
8146
|
-
.get(url, { headers, observe: '
|
|
8147
|
-
.pipe(map(
|
|
8169
|
+
.get(url, { headers, observe: 'response' })
|
|
8170
|
+
.pipe(map((response) => {
|
|
8171
|
+
this.updateClientContextStorage(response.headers);
|
|
8172
|
+
return response.body.documentResources;
|
|
8173
|
+
}), catchError(error => {
|
|
8148
8174
|
this.errorService.setError(error);
|
|
8149
8175
|
return throwError(error);
|
|
8150
8176
|
}));
|
|
@@ -8177,17 +8203,6 @@ class CasesService {
|
|
|
8177
8203
|
wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
|
|
8178
8204
|
});
|
|
8179
8205
|
}
|
|
8180
|
-
/*
|
|
8181
|
-
Checks if the user has role of pui-case-manager and returns true or false
|
|
8182
|
-
*/
|
|
8183
|
-
isPuiCaseManager() {
|
|
8184
|
-
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
8185
|
-
if (userInfoStr) {
|
|
8186
|
-
const userInfo = JSON.parse(userInfoStr);
|
|
8187
|
-
return userInfo && userInfo.roles && (userInfo.roles.indexOf(CasesService.PUI_CASE_MANAGER) !== -1);
|
|
8188
|
-
}
|
|
8189
|
-
return false;
|
|
8190
|
-
}
|
|
8191
8206
|
getCourtOrHearingCentreName(locationId) {
|
|
8192
8207
|
return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
|
|
8193
8208
|
}
|
|
@@ -8254,6 +8269,25 @@ class CasesService {
|
|
|
8254
8269
|
.get(url)
|
|
8255
8270
|
.pipe(catchError(error => throwError(error)));
|
|
8256
8271
|
}
|
|
8272
|
+
addClientContextHeader(headers) {
|
|
8273
|
+
const clientContextDetails = this.sessionStorageService.getItem('clientContext');
|
|
8274
|
+
if (clientContextDetails) {
|
|
8275
|
+
// may require URI encoding in certain circumstances
|
|
8276
|
+
const clientContext = window.btoa(clientContextDetails);
|
|
8277
|
+
if (clientContext) {
|
|
8278
|
+
headers = headers.set('Client-Context', clientContext);
|
|
8279
|
+
}
|
|
8280
|
+
}
|
|
8281
|
+
return headers;
|
|
8282
|
+
}
|
|
8283
|
+
updateClientContextStorage(headers) {
|
|
8284
|
+
// for mocking - TODO: Kasi Remove/Uncomment for testing
|
|
8285
|
+
// headers = this.setMockClientContextHeader(headers);
|
|
8286
|
+
if (headers && headers.get('Client-Context')) {
|
|
8287
|
+
const clientContextString = window.atob(headers.get('Client-Context'));
|
|
8288
|
+
this.sessionStorageService.setItem('clientContext', clientContextString);
|
|
8289
|
+
}
|
|
8290
|
+
}
|
|
8257
8291
|
static ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(OrderService), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0.ɵɵinject(LoadingService), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(RetryUtil)); };
|
|
8258
8292
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8259
8293
|
}
|
|
@@ -8766,8 +8800,9 @@ class EventCompletionStateMachineService {
|
|
|
8766
8800
|
entryActionForStateCompleteEventAndTask(state, context) {
|
|
8767
8801
|
// Trigger final state to complete processing of state machine
|
|
8768
8802
|
state.trigger(EventCompletionStates.Final);
|
|
8769
|
-
const
|
|
8770
|
-
|
|
8803
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8804
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8805
|
+
if (userTask?.task_data) {
|
|
8771
8806
|
context.sessionStorageService.setItem('assignNeeded', 'false');
|
|
8772
8807
|
// just set event can be completed
|
|
8773
8808
|
context.component.eventCanBeCompleted.emit(true);
|
|
@@ -8786,9 +8821,9 @@ class EventCompletionStateMachineService {
|
|
|
8786
8821
|
entryActionForStateTaskUnassigned(state, context) {
|
|
8787
8822
|
// Trigger final state to complete processing of state machine
|
|
8788
8823
|
state.trigger(EventCompletionStates.Final);
|
|
8789
|
-
|
|
8790
|
-
const
|
|
8791
|
-
if (
|
|
8824
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8825
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8826
|
+
if (userTask?.task_data) {
|
|
8792
8827
|
context.sessionStorageService.setItem('assignNeeded', 'true');
|
|
8793
8828
|
context.component.eventCanBeCompleted.emit(true);
|
|
8794
8829
|
}
|
|
@@ -8823,6 +8858,11 @@ class EventCompletionStateMachineService {
|
|
|
8823
8858
|
addTransitionsForStateTaskUnassigned() {
|
|
8824
8859
|
this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
|
|
8825
8860
|
}
|
|
8861
|
+
taskPresentInSessionStorage(context) {
|
|
8862
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8863
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8864
|
+
return !!userTask.task_data;
|
|
8865
|
+
}
|
|
8826
8866
|
static ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
|
|
8827
8867
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
|
|
8828
8868
|
}
|
|
@@ -8949,8 +8989,14 @@ class WorkAllocationService {
|
|
|
8949
8989
|
}
|
|
8950
8990
|
isWAEnabled(jurisdiction, caseType) {
|
|
8951
8991
|
this.features = this.appConfig.getWAServiceConfig();
|
|
8952
|
-
|
|
8953
|
-
|
|
8992
|
+
if (this.features) {
|
|
8993
|
+
const ftstr = JSON.stringify(this.features);
|
|
8994
|
+
this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning ${ftstr?.length > 0}`);
|
|
8995
|
+
}
|
|
8996
|
+
else {
|
|
8997
|
+
this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning no features`);
|
|
8998
|
+
return false;
|
|
8999
|
+
}
|
|
8954
9000
|
let enabled = false;
|
|
8955
9001
|
if (!jurisdiction || !caseType) {
|
|
8956
9002
|
const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
@@ -9332,13 +9378,12 @@ class CaseEditComponent {
|
|
|
9332
9378
|
this.isSubmitting = true;
|
|
9333
9379
|
// We have to run the event completion checks if task in session storage
|
|
9334
9380
|
// and if the task is in session storage, then is it associated to the case
|
|
9335
|
-
|
|
9381
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
9382
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9383
|
+
const taskInSessionStorage = userTask ? userTask.task_data : null;
|
|
9336
9384
|
let taskEventInSessionStorage;
|
|
9337
9385
|
const taskStr = this.sessionStorageService.getItem('taskToComplete');
|
|
9338
9386
|
const taskEventStr = this.sessionStorageService.getItem('taskEvent');
|
|
9339
|
-
if (taskStr) {
|
|
9340
|
-
taskInSessionStorage = JSON.parse(taskStr);
|
|
9341
|
-
}
|
|
9342
9387
|
if (taskEventStr) {
|
|
9343
9388
|
taskEventInSessionStorage = JSON.parse(taskEventStr);
|
|
9344
9389
|
}
|
|
@@ -9549,15 +9594,15 @@ class CaseEditComponent {
|
|
|
9549
9594
|
});
|
|
9550
9595
|
}
|
|
9551
9596
|
postCompleteTaskIfRequired() {
|
|
9552
|
-
const
|
|
9597
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
9598
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9599
|
+
const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
|
|
9553
9600
|
const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
|
|
9554
|
-
if (
|
|
9555
|
-
const task = JSON.parse(taskStr);
|
|
9601
|
+
if (task && assignNeeded && taskToBeCompleted) {
|
|
9556
9602
|
this.abstractConfig.logMessage(`postCompleteTaskIfRequired with assignNeeded: taskId ${task.id} and event name ${this.eventTrigger.name}`);
|
|
9557
9603
|
return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name);
|
|
9558
9604
|
}
|
|
9559
|
-
else if (
|
|
9560
|
-
const task = JSON.parse(taskStr);
|
|
9605
|
+
else if (task && taskToBeCompleted) {
|
|
9561
9606
|
this.abstractConfig.logMessage(`postCompleteTaskIfRequired: taskId ${task.id} and event name ${this.eventTrigger.name}`);
|
|
9562
9607
|
return this.workAllocationService.completeTask(task.id, this.eventTrigger.name);
|
|
9563
9608
|
}
|
|
@@ -11159,8 +11204,12 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11159
11204
|
}
|
|
11160
11205
|
onContinue() {
|
|
11161
11206
|
// Get task details
|
|
11162
|
-
const
|
|
11163
|
-
|
|
11207
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
11208
|
+
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
11209
|
+
const task = userTask ? userTask.task_data : null;
|
|
11210
|
+
// not complete_task not utilised here as related to event completion
|
|
11211
|
+
// service wanting task associated with event to not be completed not directly relevant
|
|
11212
|
+
if (task) {
|
|
11164
11213
|
this.sessionStorageService.setItem('assignNeeded', 'true');
|
|
11165
11214
|
// set event can be completed to true
|
|
11166
11215
|
this.parentComponent.eventCanBeCompleted.emit(true);
|
|
@@ -11184,7 +11233,7 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11184
11233
|
type: Inject,
|
|
11185
11234
|
args: [COMPONENT_PORTAL_INJECTION_TOKEN]
|
|
11186
11235
|
}] }, { type: i1$1.ActivatedRoute }, { type: WorkAllocationService }, { type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }, { type: AlertService }], null); })();
|
|
11187
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber:
|
|
11236
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber: 19 }); })();
|
|
11188
11237
|
|
|
11189
11238
|
function CaseEventCompletionComponent_ng_template_0_Template(rf, ctx) { }
|
|
11190
11239
|
const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
|
|
@@ -20109,6 +20158,7 @@ class QueryCheckYourAnswersComponent {
|
|
|
20109
20158
|
}
|
|
20110
20159
|
extractIdBasedOnConditions(data) {
|
|
20111
20160
|
// Check if field_type.id is 'CaseQueriesCollection' and field_type.type is 'Complex'
|
|
20161
|
+
console.log('data ------', data);
|
|
20112
20162
|
if (data.field_type.id === this.CASE_QUERIES_COLLECTION_ID &&
|
|
20113
20163
|
data.field_type.type === this.FIELD_TYPE_COMPLEX) {
|
|
20114
20164
|
// Set the field ID dynamically based on the extracted data
|
|
@@ -33892,7 +33942,7 @@ class EventStartGuard {
|
|
|
33892
33942
|
workAllocationService;
|
|
33893
33943
|
router;
|
|
33894
33944
|
sessionStorageService;
|
|
33895
|
-
static
|
|
33945
|
+
static CLIENT_CONTEXT = 'clientContext';
|
|
33896
33946
|
constructor(workAllocationService, router, sessionStorageService) {
|
|
33897
33947
|
this.workAllocationService = workAllocationService;
|
|
33898
33948
|
this.router = router;
|
|
@@ -33943,18 +33993,26 @@ class EventStartGuard {
|
|
|
33943
33993
|
task = tasksAssignedToUser[0];
|
|
33944
33994
|
}
|
|
33945
33995
|
// if one task assigned to user, allow user to complete event
|
|
33946
|
-
|
|
33996
|
+
const storeClientContext = {
|
|
33997
|
+
client_context: {
|
|
33998
|
+
user_task: {
|
|
33999
|
+
task_data: task,
|
|
34000
|
+
complete_task: true
|
|
34001
|
+
}
|
|
34002
|
+
}
|
|
34003
|
+
};
|
|
34004
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
33947
34005
|
return true;
|
|
33948
34006
|
}
|
|
33949
34007
|
}
|
|
33950
34008
|
removeTaskFromSessionStorage() {
|
|
33951
|
-
this.sessionStorageService.removeItem(EventStartGuard.
|
|
34009
|
+
this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
|
|
33952
34010
|
}
|
|
33953
34011
|
checkForTasks(payload, caseId, eventId, taskId) {
|
|
33954
34012
|
if (taskId && payload?.tasks?.length > 0) {
|
|
33955
34013
|
const task = payload.tasks.find((t) => t.id == taskId);
|
|
33956
34014
|
if (task) {
|
|
33957
|
-
this.sessionStorageService.setItem(EventStartGuard.
|
|
34015
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
|
|
33958
34016
|
}
|
|
33959
34017
|
else {
|
|
33960
34018
|
this.removeTaskFromSessionStorage();
|
|
@@ -34122,9 +34180,17 @@ class EventStartStateMachineService {
|
|
|
34122
34180
|
task = context.tasks[0];
|
|
34123
34181
|
}
|
|
34124
34182
|
const taskStr = JSON.stringify(task);
|
|
34125
|
-
console.log('entryActionForStateOneTaskAssignedToUser: setting
|
|
34183
|
+
console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
|
|
34126
34184
|
// Store task to session
|
|
34127
|
-
|
|
34185
|
+
const clientContext = {
|
|
34186
|
+
client_context: {
|
|
34187
|
+
user_task: {
|
|
34188
|
+
task_data: task,
|
|
34189
|
+
complete_task: true
|
|
34190
|
+
}
|
|
34191
|
+
}
|
|
34192
|
+
};
|
|
34193
|
+
context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
|
|
34128
34194
|
// Allow user to perform the event
|
|
34129
34195
|
context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
|
|
34130
34196
|
}
|