@hmcts/ccd-case-ui-toolkit 7.1.27 → 7.1.28-auto-task-completing-fix
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 +37 -15
- package/esm2022/lib/shared/components/case-editor/case-edit-utils/case-edit.utils.mjs +13 -1
- package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.mjs +3 -2
- package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +4 -3
- package/esm2022/lib/shared/components/case-editor/services/cases.service.mjs +4 -3
- package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +5 -4
- package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +10 -13
- package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +5 -3
- package/esm2022/lib/shared/components/palette/document/write-document-field.component.mjs +17 -5
- package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +726 -685
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +6 -2
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-utils/case-edit.utils.d.ts +2 -0
- package/lib/shared/components/case-editor/case-edit-utils/case-edit.utils.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.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.map +1 -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.map +1 -1
- package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +0 -2
- 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/document/write-document-field.component.d.ts +3 -1
- package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
- package/lib/shared/domain/work-allocation/Task.d.ts +1 -0
- package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8036,354 +8036,142 @@ class WizardPageFieldToCaseFieldMapper {
|
|
|
8036
8036
|
}]
|
|
8037
8037
|
}], null, null); })();
|
|
8038
8038
|
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8039
|
+
class Confirmation {
|
|
8040
|
+
caseId;
|
|
8041
|
+
status;
|
|
8042
|
+
header;
|
|
8043
|
+
body;
|
|
8044
|
+
constructor(caseId, status, header, body) {
|
|
8045
|
+
this.caseId = caseId;
|
|
8046
|
+
this.status = status;
|
|
8047
|
+
this.header = header;
|
|
8048
|
+
this.body = body;
|
|
8044
8049
|
}
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
}
|
|
8048
|
-
class CaseEditUtils {
|
|
8049
|
-
static PREFIX = '&#';
|
|
8050
|
-
static SUFFIX = ';';
|
|
8051
|
-
convertNonASCIICharacters(rawString) {
|
|
8052
|
-
return rawString ? rawString.replace(/[^\x20-\x7E]/g, function (c) {
|
|
8053
|
-
return convertNonASCIICharacter(c);
|
|
8054
|
-
}) : '';
|
|
8050
|
+
getCaseId() {
|
|
8051
|
+
return this.caseId;
|
|
8055
8052
|
}
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
else {
|
|
8065
|
-
const suffixSplitList = currentSection.split(CaseEditUtils.SUFFIX);
|
|
8066
|
-
const characterCode = Number(suffixSplitList[0]);
|
|
8067
|
-
rawString = rawString.concat(String.fromCharCode(characterCode), suffixSplitList[1]);
|
|
8068
|
-
}
|
|
8069
|
-
}
|
|
8070
|
-
return rawString;
|
|
8053
|
+
getStatus() {
|
|
8054
|
+
return this.status;
|
|
8055
|
+
}
|
|
8056
|
+
getHeader() {
|
|
8057
|
+
return this.header;
|
|
8058
|
+
}
|
|
8059
|
+
getBody() {
|
|
8060
|
+
return this.body;
|
|
8071
8061
|
}
|
|
8072
8062
|
}
|
|
8073
8063
|
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8064
|
+
var EventCompletionReturnStates;
|
|
8065
|
+
(function (EventCompletionReturnStates) {
|
|
8066
|
+
EventCompletionReturnStates["InProgress"] = "in-progress";
|
|
8067
|
+
EventCompletionReturnStates["CompleteEvent"] = "complete-event";
|
|
8068
|
+
EventCompletionReturnStates["CancelEvent"] = "cancel-event";
|
|
8069
|
+
})(EventCompletionReturnStates || (EventCompletionReturnStates = {}));
|
|
8070
|
+
|
|
8071
|
+
var EventCompletionStates;
|
|
8072
|
+
(function (EventCompletionStates) {
|
|
8073
|
+
EventCompletionStates["CheckTasksCanBeCompleted"] = "check-tasks-can-be-completed";
|
|
8074
|
+
EventCompletionStates["CompleteEventAndTask"] = "complete-event-and-task";
|
|
8075
|
+
EventCompletionStates["CancelEvent"] = "cancel-event";
|
|
8076
|
+
EventCompletionStates["CompleteEventNotTask"] = "complete-event-not-task";
|
|
8077
|
+
EventCompletionStates["TaskCompetedOrCancelled"] = "task-completed-or-cancelled";
|
|
8078
|
+
EventCompletionStates["TaskAssignedToAnotherUser"] = "task-assigned-to-another-user";
|
|
8079
|
+
EventCompletionStates["TaskReassignToUser"] = "task-reassign-to-user";
|
|
8080
|
+
EventCompletionStates["TaskAssignToUser"] = "task-assign-to-user";
|
|
8081
|
+
EventCompletionStates["TaskUnassigned"] = "task-unassigned";
|
|
8082
|
+
EventCompletionStates["Final"] = "final";
|
|
8083
|
+
})(EventCompletionStates || (EventCompletionStates = {}));
|
|
8084
|
+
|
|
8085
|
+
class Wizard {
|
|
8086
|
+
pages;
|
|
8087
|
+
orderService = new OrderService();
|
|
8088
|
+
constructor(wizardPages) {
|
|
8089
|
+
this.pages = this.orderService.sort(wizardPages);
|
|
8100
8090
|
}
|
|
8101
|
-
|
|
8102
|
-
return
|
|
8103
|
-
caseId,
|
|
8104
|
-
attributesToUpdate
|
|
8105
|
-
});
|
|
8091
|
+
firstPage(canShow) {
|
|
8092
|
+
return this.pages.find(page => canShow(page));
|
|
8106
8093
|
}
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
this.loadingService = loadingService;
|
|
8114
|
-
this.sessionStorageService = sessionStorageService;
|
|
8115
|
-
this.retryUtil = retryUtil;
|
|
8094
|
+
getPage(pageId, canShow) {
|
|
8095
|
+
const foundPage = this.findPage(pageId);
|
|
8096
|
+
if (!foundPage) {
|
|
8097
|
+
throw new Error(`No page for ID: ${pageId}`);
|
|
8098
|
+
}
|
|
8099
|
+
return canShow(foundPage) ? foundPage : undefined;
|
|
8116
8100
|
}
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
return this.http
|
|
8121
|
-
.get(url)
|
|
8122
|
-
.pipe(catchError(error => {
|
|
8123
|
-
this.errorService.setError(error);
|
|
8124
|
-
return throwError(error);
|
|
8125
|
-
}), finalize(() => this.loadingService.unregister(loadingToken)));
|
|
8101
|
+
findWizardPage(caseFieldId) {
|
|
8102
|
+
return this.pages.find(wizardPage => wizardPage.case_fields &&
|
|
8103
|
+
wizardPage.case_fields?.filter(caseField => caseField.id === caseFieldId).length > 0);
|
|
8126
8104
|
}
|
|
8127
|
-
|
|
8128
|
-
const
|
|
8129
|
-
|
|
8130
|
-
.
|
|
8131
|
-
.
|
|
8132
|
-
.set('Content-Type', 'application/json');
|
|
8133
|
-
const loadingToken = this.loadingService.register();
|
|
8134
|
-
let http$ = this.http.get(url, { headers, observe: 'body' });
|
|
8135
|
-
const artificialDelay = this.appConfig.getTimeoutsCaseRetrievalArtificialDelay();
|
|
8136
|
-
const timeoutPeriods = this.appConfig.getTimeoutsForCaseRetrieval();
|
|
8137
|
-
console.log(`Timeout periods: ${timeoutPeriods} seconds.`);
|
|
8138
|
-
if (timeoutPeriods && timeoutPeriods.length > 0 && timeoutPeriods[0] > 0) {
|
|
8139
|
-
http$ = this.retryUtil.pipeTimeoutMechanismOn(http$, artificialDelay, timeoutPeriods);
|
|
8140
|
-
}
|
|
8141
|
-
else {
|
|
8142
|
-
console.warn('Skipping to pipe a retry mechanism!');
|
|
8143
|
-
}
|
|
8144
|
-
http$ = this.pipeErrorProcessor(http$);
|
|
8145
|
-
http$ = http$.pipe(finalize(() => this.finalizeGetCaseViewWith(caseId, loadingToken)));
|
|
8146
|
-
return http$;
|
|
8105
|
+
nextPage(pageId, canShow) {
|
|
8106
|
+
const currentIndex = this.findExistingIndex(pageId);
|
|
8107
|
+
return this.pages
|
|
8108
|
+
.slice(currentIndex + 1)
|
|
8109
|
+
.find(page => canShow(page));
|
|
8147
8110
|
}
|
|
8148
|
-
|
|
8149
|
-
const
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
}));
|
|
8155
|
-
return out$;
|
|
8111
|
+
previousPage(pageId, canShow) {
|
|
8112
|
+
const currentIndex = this.findExistingIndex(pageId);
|
|
8113
|
+
return this.pages
|
|
8114
|
+
.slice(0, currentIndex)
|
|
8115
|
+
.reverse()
|
|
8116
|
+
.find(page => canShow(page));
|
|
8156
8117
|
}
|
|
8157
|
-
|
|
8158
|
-
this.
|
|
8118
|
+
hasPage(pageId) {
|
|
8119
|
+
return !!this.findPage(pageId);
|
|
8159
8120
|
}
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
while (Date.now() < end)
|
|
8163
|
-
continue;
|
|
8121
|
+
hasPreviousPage(pageId, canShow) {
|
|
8122
|
+
return !!this.previousPage(pageId, canShow);
|
|
8164
8123
|
}
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
const url = this.buildEventTriggerUrl(caseTypeId, eventTriggerId, caseId, ignoreWarning);
|
|
8168
|
-
let headers = new HttpHeaders();
|
|
8169
|
-
headers = headers.set('experimental', 'true');
|
|
8170
|
-
headers = headers.set('Content-Type', 'application/json');
|
|
8171
|
-
headers = this.addClientContextHeader(headers);
|
|
8172
|
-
if (Draft.isDraft(caseId)) {
|
|
8173
|
-
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
|
|
8174
|
-
}
|
|
8175
|
-
else if (caseId !== undefined && caseId !== null) {
|
|
8176
|
-
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_EVENT_TRIGGER);
|
|
8177
|
-
}
|
|
8178
|
-
else {
|
|
8179
|
-
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
|
|
8180
|
-
}
|
|
8181
|
-
return this.http
|
|
8182
|
-
.get(url, { headers, observe: 'response' })
|
|
8183
|
-
.pipe(map((response) => {
|
|
8184
|
-
this.updateClientContextStorage(response.headers);
|
|
8185
|
-
return FieldsUtils.handleNestedDynamicLists(response.body);
|
|
8186
|
-
}), catchError(error => {
|
|
8187
|
-
this.errorService.setError(error);
|
|
8188
|
-
return throwError(error);
|
|
8189
|
-
}), map((p) => plainToClass(CaseEventTrigger, p)), tap(eventTrigger => this.initialiseEventTrigger(eventTrigger)));
|
|
8124
|
+
reverse() {
|
|
8125
|
+
return this.pages.slice().reverse();
|
|
8190
8126
|
}
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
|
|
8194
|
-
let headers = new HttpHeaders()
|
|
8195
|
-
.set('experimental', 'true')
|
|
8196
|
-
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
|
|
8197
|
-
.set('Content-Type', 'application/json');
|
|
8198
|
-
headers = this.addClientContextHeader(headers);
|
|
8199
|
-
return this.http
|
|
8200
|
-
.post(url, eventData, { headers, observe: 'response' })
|
|
8201
|
-
.pipe(map((response) => {
|
|
8202
|
-
this.updateClientContextStorage(response.headers);
|
|
8203
|
-
return response.body;
|
|
8204
|
-
}), catchError(error => {
|
|
8205
|
-
this.errorService.setError(error);
|
|
8206
|
-
return throwError(error);
|
|
8207
|
-
}));
|
|
8127
|
+
findPage(pageId) {
|
|
8128
|
+
return this.pages.find(page => pageId === page.id);
|
|
8208
8129
|
}
|
|
8209
|
-
|
|
8210
|
-
const
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
.set('Content-Type', 'application/json');
|
|
8216
|
-
headers = this.addClientContextHeader(headers);
|
|
8217
|
-
return this.http
|
|
8218
|
-
.post(url, eventData, { headers, observe: 'response' })
|
|
8219
|
-
.pipe(map((response) => {
|
|
8220
|
-
this.updateClientContextStorage(response.headers);
|
|
8221
|
-
return response.body;
|
|
8222
|
-
}), catchError(error => {
|
|
8223
|
-
this.errorService.setError(error);
|
|
8224
|
-
return throwError(error);
|
|
8225
|
-
}));
|
|
8130
|
+
findExistingIndex(pageId) {
|
|
8131
|
+
const index = this.pages.findIndex(page => pageId === page.id);
|
|
8132
|
+
if (-1 === index) {
|
|
8133
|
+
throw new Error(`No page for ID: ${pageId}`);
|
|
8134
|
+
}
|
|
8135
|
+
return index;
|
|
8226
8136
|
}
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
.set('experimental', 'true')
|
|
8235
|
-
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
|
|
8236
|
-
.set('Content-Type', 'application/json');
|
|
8237
|
-
headers = this.addClientContextHeader(headers);
|
|
8238
|
-
return this.http
|
|
8239
|
-
.post(url, eventData, { headers, observe: 'response' })
|
|
8240
|
-
.pipe(map((response) => {
|
|
8241
|
-
this.updateClientContextStorage(response.headers);
|
|
8242
|
-
return response.body;
|
|
8243
|
-
}), catchError(error => {
|
|
8244
|
-
this.errorService.setError(error);
|
|
8245
|
-
return throwError(error);
|
|
8246
|
-
}));
|
|
8247
|
-
}
|
|
8248
|
-
getPrintDocuments(caseId) {
|
|
8249
|
-
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
|
|
8250
|
-
let headers = new HttpHeaders()
|
|
8251
|
-
.set('experimental', 'true')
|
|
8252
|
-
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
|
|
8253
|
-
.set('Content-Type', 'application/json');
|
|
8254
|
-
headers = this.addClientContextHeader(headers);
|
|
8255
|
-
return this.http
|
|
8256
|
-
.get(url, { headers, observe: 'response' })
|
|
8257
|
-
.pipe(map((response) => {
|
|
8258
|
-
this.updateClientContextStorage(response.headers);
|
|
8259
|
-
return response.body.documentResources;
|
|
8260
|
-
}), catchError(error => {
|
|
8261
|
-
this.errorService.setError(error);
|
|
8262
|
-
return throwError(error);
|
|
8263
|
-
}));
|
|
8264
|
-
}
|
|
8265
|
-
buildEventTriggerUrl(caseTypeId, eventTriggerId, caseId, ignoreWarning) {
|
|
8266
|
-
let url = `${this.appConfig.getCaseDataUrl()}/internal`;
|
|
8267
|
-
if (Draft.isDraft(caseId)) {
|
|
8268
|
-
url += `/drafts/${caseId}`
|
|
8269
|
-
+ `/event-trigger`
|
|
8270
|
-
+ `?ignore-warning=${ignoreWarning}`;
|
|
8271
|
-
}
|
|
8272
|
-
else if (caseTypeId === undefined || caseTypeId === null) {
|
|
8273
|
-
url += `/cases/${caseId}`
|
|
8274
|
-
+ `/event-triggers/${eventTriggerId}`
|
|
8275
|
-
+ `?ignore-warning=${ignoreWarning}`;
|
|
8276
|
-
}
|
|
8277
|
-
else {
|
|
8278
|
-
url += `/case-types/${caseTypeId}`
|
|
8279
|
-
+ `/event-triggers/${eventTriggerId}`
|
|
8280
|
-
+ `?ignore-warning=${ignoreWarning}`;
|
|
8281
|
-
}
|
|
8282
|
-
return url;
|
|
8283
|
-
}
|
|
8284
|
-
initialiseEventTrigger(eventTrigger) {
|
|
8285
|
-
if (!eventTrigger.wizard_pages) {
|
|
8286
|
-
eventTrigger.wizard_pages = [];
|
|
8287
|
-
}
|
|
8288
|
-
eventTrigger.wizard_pages.forEach((wizardPage) => {
|
|
8289
|
-
wizardPage.parsedShowCondition = ShowCondition.getInstance(wizardPage.show_condition);
|
|
8290
|
-
wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
|
|
8291
|
-
});
|
|
8292
|
-
}
|
|
8293
|
-
getCourtOrHearingCentreName(locationId) {
|
|
8294
|
-
return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
|
|
8295
|
-
}
|
|
8296
|
-
createChallengedAccessRequest(caseId, request) {
|
|
8297
|
-
// Assignment API endpoint
|
|
8298
|
-
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
8299
|
-
const camUtils = new CaseAccessUtils();
|
|
8300
|
-
let userInfo;
|
|
8301
|
-
if (userInfoStr) {
|
|
8302
|
-
userInfo = JSON.parse(userInfoStr);
|
|
8303
|
-
}
|
|
8304
|
-
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
8305
|
-
const roleName = camUtils.getAMRoleName('challenged', roleCategory);
|
|
8306
|
-
const beginTime = new Date();
|
|
8307
|
-
const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
|
|
8308
|
-
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
8309
|
-
const isNew = true;
|
|
8310
|
-
const payload = camUtils.getAMPayload(id, id, roleName, roleCategory, 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
|
|
8311
|
-
return this.http.post(`/api/challenged-access-request`, payload);
|
|
8137
|
+
}
|
|
8138
|
+
|
|
8139
|
+
class ConvertHrefToRouterService {
|
|
8140
|
+
router;
|
|
8141
|
+
hrefMarkdownLinkContent = new BehaviorSubject('Default');
|
|
8142
|
+
constructor(router) {
|
|
8143
|
+
this.router = router;
|
|
8312
8144
|
}
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
8316
|
-
const camUtils = new CaseAccessUtils();
|
|
8317
|
-
let userInfo;
|
|
8318
|
-
if (userInfoStr) {
|
|
8319
|
-
userInfo = JSON.parse(userInfoStr);
|
|
8320
|
-
}
|
|
8321
|
-
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
8322
|
-
const roleName = camUtils.getAMRoleName('specific', roleCategory);
|
|
8323
|
-
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
8324
|
-
const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);
|
|
8325
|
-
payload.roleRequest = {
|
|
8326
|
-
...payload.roleRequest,
|
|
8327
|
-
process: 'specific-access',
|
|
8328
|
-
replaceExisting: true,
|
|
8329
|
-
assignerId: payload.requestedRoles[0].actorId,
|
|
8330
|
-
reference: `${caseId}/${roleName}/${payload.requestedRoles[0].actorId}`
|
|
8331
|
-
};
|
|
8332
|
-
payload.requestedRoles[0] = {
|
|
8333
|
-
...payload.requestedRoles[0],
|
|
8334
|
-
roleName: 'specific-access-requested',
|
|
8335
|
-
roleCategory,
|
|
8336
|
-
classification: 'PRIVATE',
|
|
8337
|
-
endTime: new Date(new Date().setDate(new Date().getDate() + 30)),
|
|
8338
|
-
beginTime: null,
|
|
8339
|
-
grantType: 'BASIC',
|
|
8340
|
-
readOnly: true
|
|
8341
|
-
};
|
|
8342
|
-
payload.requestedRoles[0].attributes = {
|
|
8343
|
-
...payload.requestedRoles[0].attributes,
|
|
8344
|
-
requestedRole: roleName,
|
|
8345
|
-
specificAccessReason: sar.specificReason
|
|
8346
|
-
};
|
|
8347
|
-
payload.requestedRoles[0].notes[0] = {
|
|
8348
|
-
...payload.requestedRoles[0].notes[0],
|
|
8349
|
-
userId: payload.requestedRoles[0].actorId
|
|
8350
|
-
};
|
|
8351
|
-
return this.http.post(`/api/specific-access-request`, payload);
|
|
8145
|
+
updateHrefLink(content) {
|
|
8146
|
+
this.hrefMarkdownLinkContent.next(content);
|
|
8352
8147
|
}
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
return this.http
|
|
8356
|
-
.get(url)
|
|
8357
|
-
.pipe(catchError(error => throwError(error)));
|
|
8148
|
+
getHrefMarkdownLinkContent() {
|
|
8149
|
+
return this.hrefMarkdownLinkContent.asObservable();
|
|
8358
8150
|
}
|
|
8359
|
-
|
|
8360
|
-
const
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
const
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8151
|
+
callAngularRouter(hrefMarkdownLinkContent) {
|
|
8152
|
+
const urls = hrefMarkdownLinkContent.split('?');
|
|
8153
|
+
const queryParams = urls[1];
|
|
8154
|
+
const queryParamObj = {};
|
|
8155
|
+
if (queryParams) {
|
|
8156
|
+
const queryParam = queryParams.split('&');
|
|
8157
|
+
if (queryParam[0]) {
|
|
8158
|
+
// tslint:disable-next-line: prefer-for-of
|
|
8159
|
+
for (let i = 0; i < queryParam.length; i++) {
|
|
8160
|
+
const param = queryParam[i].split('=');
|
|
8161
|
+
queryParamObj[param[0]] = param[1];
|
|
8162
|
+
}
|
|
8368
8163
|
}
|
|
8369
8164
|
}
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
if (headers && headers.get('Client-Context')) {
|
|
8374
|
-
const caseEditUtils = new CaseEditUtils();
|
|
8375
|
-
const clientContextString = window.atob(headers.get('Client-Context'));
|
|
8376
|
-
// below reverts non-ASCII characters
|
|
8377
|
-
const editedClientContextString = caseEditUtils.convertHTMLEntities(clientContextString);
|
|
8378
|
-
this.sessionStorageService.setItem('clientContext', editedClientContextString);
|
|
8379
|
-
}
|
|
8165
|
+
this.router.navigate([urls[0]], {
|
|
8166
|
+
queryParams: queryParamObj && (Object.keys(queryParamObj).length) ? queryParamObj : ''
|
|
8167
|
+
});
|
|
8380
8168
|
}
|
|
8381
|
-
static ɵfac = function
|
|
8382
|
-
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token:
|
|
8169
|
+
static ɵfac = function ConvertHrefToRouterService_Factory(t) { return new (t || ConvertHrefToRouterService)(i0.ɵɵinject(i1$1.Router)); };
|
|
8170
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConvertHrefToRouterService, factory: ConvertHrefToRouterService.ɵfac });
|
|
8383
8171
|
}
|
|
8384
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
8172
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConvertHrefToRouterService, [{
|
|
8385
8173
|
type: Injectable
|
|
8386
|
-
}], () => [{ type:
|
|
8174
|
+
}], () => [{ type: i1$1.Router }], null); })();
|
|
8387
8175
|
|
|
8388
8176
|
class EventTriggerService {
|
|
8389
8177
|
eventTriggerSource = new Subject();
|
|
@@ -8400,270 +8188,48 @@ class EventTriggerService {
|
|
|
8400
8188
|
}]
|
|
8401
8189
|
}], null, null); })();
|
|
8402
8190
|
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
class CaseCreateComponent {
|
|
8414
|
-
casesService;
|
|
8191
|
+
class WizardFactoryService {
|
|
8192
|
+
create(eventTrigger) {
|
|
8193
|
+
return new Wizard(eventTrigger.wizard_pages);
|
|
8194
|
+
}
|
|
8195
|
+
}
|
|
8196
|
+
|
|
8197
|
+
class CaseEditWizardGuard {
|
|
8198
|
+
router;
|
|
8199
|
+
routerHelper;
|
|
8200
|
+
wizardFactory;
|
|
8415
8201
|
alertService;
|
|
8416
|
-
draftService;
|
|
8417
8202
|
eventTriggerService;
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
submitted = new EventEmitter();
|
|
8423
|
-
eventTrigger;
|
|
8424
|
-
constructor(casesService, alertService, draftService, eventTriggerService) {
|
|
8425
|
-
this.casesService = casesService;
|
|
8203
|
+
constructor(router, routerHelper, wizardFactory, alertService, eventTriggerService) {
|
|
8204
|
+
this.router = router;
|
|
8205
|
+
this.routerHelper = routerHelper;
|
|
8206
|
+
this.wizardFactory = wizardFactory;
|
|
8426
8207
|
this.alertService = alertService;
|
|
8427
|
-
this.draftService = draftService;
|
|
8428
8208
|
this.eventTriggerService = eventTriggerService;
|
|
8429
8209
|
}
|
|
8430
|
-
|
|
8431
|
-
this.
|
|
8432
|
-
.
|
|
8433
|
-
this.eventTrigger = eventTrigger;
|
|
8434
|
-
this.eventTriggerService.announceEventTrigger(eventTrigger);
|
|
8435
|
-
})
|
|
8436
|
-
.catch((error) => {
|
|
8437
|
-
this.alertService.error({ phrase: error.message });
|
|
8438
|
-
return throwError(error);
|
|
8210
|
+
resolve(route) {
|
|
8211
|
+
this.eventTriggerService.eventTriggerSource.asObservable().pipe(first()).subscribe(eventTrigger => {
|
|
8212
|
+
this.processEventTrigger(route, eventTrigger);
|
|
8439
8213
|
});
|
|
8214
|
+
if (route.parent.data.eventTrigger) {
|
|
8215
|
+
this.eventTriggerService.announceEventTrigger(route.parent.data.eventTrigger);
|
|
8216
|
+
}
|
|
8217
|
+
return Promise.resolve(true);
|
|
8440
8218
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
return
|
|
8219
|
+
processEventTrigger(route, eventTrigger) {
|
|
8220
|
+
if (!eventTrigger.hasFields() || !eventTrigger.hasPages()) {
|
|
8221
|
+
this.goToSubmit(route);
|
|
8222
|
+
return Promise.resolve(false);
|
|
8223
|
+
}
|
|
8224
|
+
const wizard = this.wizardFactory.create(eventTrigger);
|
|
8225
|
+
const currentState = this.buildState(eventTrigger.case_fields);
|
|
8226
|
+
// TODO Extract predicate and state creation in a factory
|
|
8227
|
+
const canShowPredicate = (page) => {
|
|
8228
|
+
return ShowCondition.getInstance(page.show_condition).match(currentState);
|
|
8445
8229
|
};
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
.validateCase(this.caseType, sanitizedEditForm, pageId);
|
|
8450
|
-
}
|
|
8451
|
-
saveDraft() {
|
|
8452
|
-
if (this.eventTrigger.can_save_draft) {
|
|
8453
|
-
return (caseEventData) => this.draftService.createOrUpdateDraft(this.caseType, this.eventTrigger.case_id, caseEventData);
|
|
8454
|
-
}
|
|
8455
|
-
}
|
|
8456
|
-
emitCancelled(event) {
|
|
8457
|
-
this.cancelled.emit(event);
|
|
8458
|
-
}
|
|
8459
|
-
emitSubmitted(event) {
|
|
8460
|
-
this.submitted.emit(event);
|
|
8461
|
-
}
|
|
8462
|
-
isDataLoaded() {
|
|
8463
|
-
return this.eventTrigger ? true : false;
|
|
8464
|
-
}
|
|
8465
|
-
static ɵfac = function CaseCreateComponent_Factory(t) { return new (t || CaseCreateComponent)(i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(DraftService), i0.ɵɵdirectiveInject(EventTriggerService)); };
|
|
8466
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseCreateComponent, selectors: [["ccd-case-create"]], inputs: { jurisdiction: "jurisdiction", caseType: "caseType", event: "event" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, decls: 1, vars: 1, consts: [[4, "ngIf"], [3, "cancelled", "submitted", "submit", "validate", "saveDraft", "eventTrigger"]], template: function CaseCreateComponent_Template(rf, ctx) { if (rf & 1) {
|
|
8467
|
-
i0.ɵɵtemplate(0, CaseCreateComponent_div_0_Template, 2, 4, "div", 0);
|
|
8468
|
-
} if (rf & 2) {
|
|
8469
|
-
i0.ɵɵproperty("ngIf", ctx.isDataLoaded());
|
|
8470
|
-
} }, encapsulation: 2 });
|
|
8471
|
-
}
|
|
8472
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseCreateComponent, [{
|
|
8473
|
-
type: Component,
|
|
8474
|
-
args: [{ selector: 'ccd-case-create', template: "<div *ngIf=\"isDataLoaded()\">\n <ccd-case-edit [submit]=\"submit()\"\n [validate]=\"validate()\"\n [saveDraft]=\"saveDraft()\"\n [eventTrigger]=\"eventTrigger\"\n (cancelled)=\"emitCancelled($event)\"\n (submitted)=\"emitSubmitted($event)\"></ccd-case-edit>\n</div>" }]
|
|
8475
|
-
}], () => [{ type: CasesService }, { type: AlertService }, { type: DraftService }, { type: EventTriggerService }], { jurisdiction: [{
|
|
8476
|
-
type: Input
|
|
8477
|
-
}], caseType: [{
|
|
8478
|
-
type: Input
|
|
8479
|
-
}], event: [{
|
|
8480
|
-
type: Input
|
|
8481
|
-
}], cancelled: [{
|
|
8482
|
-
type: Output
|
|
8483
|
-
}], submitted: [{
|
|
8484
|
-
type: Output
|
|
8485
|
-
}] }); })();
|
|
8486
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseCreateComponent, { className: "CaseCreateComponent", filePath: "lib/shared/components/case-editor/case-create/case-create.component.ts", lineNumber: 17 }); })();
|
|
8487
|
-
|
|
8488
|
-
class Confirmation {
|
|
8489
|
-
caseId;
|
|
8490
|
-
status;
|
|
8491
|
-
header;
|
|
8492
|
-
body;
|
|
8493
|
-
constructor(caseId, status, header, body) {
|
|
8494
|
-
this.caseId = caseId;
|
|
8495
|
-
this.status = status;
|
|
8496
|
-
this.header = header;
|
|
8497
|
-
this.body = body;
|
|
8498
|
-
}
|
|
8499
|
-
getCaseId() {
|
|
8500
|
-
return this.caseId;
|
|
8501
|
-
}
|
|
8502
|
-
getStatus() {
|
|
8503
|
-
return this.status;
|
|
8504
|
-
}
|
|
8505
|
-
getHeader() {
|
|
8506
|
-
return this.header;
|
|
8507
|
-
}
|
|
8508
|
-
getBody() {
|
|
8509
|
-
return this.body;
|
|
8510
|
-
}
|
|
8511
|
-
}
|
|
8512
|
-
|
|
8513
|
-
var EventCompletionReturnStates;
|
|
8514
|
-
(function (EventCompletionReturnStates) {
|
|
8515
|
-
EventCompletionReturnStates["InProgress"] = "in-progress";
|
|
8516
|
-
EventCompletionReturnStates["CompleteEvent"] = "complete-event";
|
|
8517
|
-
EventCompletionReturnStates["CancelEvent"] = "cancel-event";
|
|
8518
|
-
})(EventCompletionReturnStates || (EventCompletionReturnStates = {}));
|
|
8519
|
-
|
|
8520
|
-
var EventCompletionStates;
|
|
8521
|
-
(function (EventCompletionStates) {
|
|
8522
|
-
EventCompletionStates["CheckTasksCanBeCompleted"] = "check-tasks-can-be-completed";
|
|
8523
|
-
EventCompletionStates["CompleteEventAndTask"] = "complete-event-and-task";
|
|
8524
|
-
EventCompletionStates["CancelEvent"] = "cancel-event";
|
|
8525
|
-
EventCompletionStates["CompleteEventNotTask"] = "complete-event-not-task";
|
|
8526
|
-
EventCompletionStates["TaskCompetedOrCancelled"] = "task-completed-or-cancelled";
|
|
8527
|
-
EventCompletionStates["TaskAssignedToAnotherUser"] = "task-assigned-to-another-user";
|
|
8528
|
-
EventCompletionStates["TaskReassignToUser"] = "task-reassign-to-user";
|
|
8529
|
-
EventCompletionStates["TaskAssignToUser"] = "task-assign-to-user";
|
|
8530
|
-
EventCompletionStates["TaskUnassigned"] = "task-unassigned";
|
|
8531
|
-
EventCompletionStates["Final"] = "final";
|
|
8532
|
-
})(EventCompletionStates || (EventCompletionStates = {}));
|
|
8533
|
-
|
|
8534
|
-
class Wizard {
|
|
8535
|
-
pages;
|
|
8536
|
-
orderService = new OrderService();
|
|
8537
|
-
constructor(wizardPages) {
|
|
8538
|
-
this.pages = this.orderService.sort(wizardPages);
|
|
8539
|
-
}
|
|
8540
|
-
firstPage(canShow) {
|
|
8541
|
-
return this.pages.find(page => canShow(page));
|
|
8542
|
-
}
|
|
8543
|
-
getPage(pageId, canShow) {
|
|
8544
|
-
const foundPage = this.findPage(pageId);
|
|
8545
|
-
if (!foundPage) {
|
|
8546
|
-
throw new Error(`No page for ID: ${pageId}`);
|
|
8547
|
-
}
|
|
8548
|
-
return canShow(foundPage) ? foundPage : undefined;
|
|
8549
|
-
}
|
|
8550
|
-
findWizardPage(caseFieldId) {
|
|
8551
|
-
return this.pages.find(wizardPage => wizardPage.case_fields &&
|
|
8552
|
-
wizardPage.case_fields?.filter(caseField => caseField.id === caseFieldId).length > 0);
|
|
8553
|
-
}
|
|
8554
|
-
nextPage(pageId, canShow) {
|
|
8555
|
-
const currentIndex = this.findExistingIndex(pageId);
|
|
8556
|
-
return this.pages
|
|
8557
|
-
.slice(currentIndex + 1)
|
|
8558
|
-
.find(page => canShow(page));
|
|
8559
|
-
}
|
|
8560
|
-
previousPage(pageId, canShow) {
|
|
8561
|
-
const currentIndex = this.findExistingIndex(pageId);
|
|
8562
|
-
return this.pages
|
|
8563
|
-
.slice(0, currentIndex)
|
|
8564
|
-
.reverse()
|
|
8565
|
-
.find(page => canShow(page));
|
|
8566
|
-
}
|
|
8567
|
-
hasPage(pageId) {
|
|
8568
|
-
return !!this.findPage(pageId);
|
|
8569
|
-
}
|
|
8570
|
-
hasPreviousPage(pageId, canShow) {
|
|
8571
|
-
return !!this.previousPage(pageId, canShow);
|
|
8572
|
-
}
|
|
8573
|
-
reverse() {
|
|
8574
|
-
return this.pages.slice().reverse();
|
|
8575
|
-
}
|
|
8576
|
-
findPage(pageId) {
|
|
8577
|
-
return this.pages.find(page => pageId === page.id);
|
|
8578
|
-
}
|
|
8579
|
-
findExistingIndex(pageId) {
|
|
8580
|
-
const index = this.pages.findIndex(page => pageId === page.id);
|
|
8581
|
-
if (-1 === index) {
|
|
8582
|
-
throw new Error(`No page for ID: ${pageId}`);
|
|
8583
|
-
}
|
|
8584
|
-
return index;
|
|
8585
|
-
}
|
|
8586
|
-
}
|
|
8587
|
-
|
|
8588
|
-
class ConvertHrefToRouterService {
|
|
8589
|
-
router;
|
|
8590
|
-
hrefMarkdownLinkContent = new BehaviorSubject('Default');
|
|
8591
|
-
constructor(router) {
|
|
8592
|
-
this.router = router;
|
|
8593
|
-
}
|
|
8594
|
-
updateHrefLink(content) {
|
|
8595
|
-
this.hrefMarkdownLinkContent.next(content);
|
|
8596
|
-
}
|
|
8597
|
-
getHrefMarkdownLinkContent() {
|
|
8598
|
-
return this.hrefMarkdownLinkContent.asObservable();
|
|
8599
|
-
}
|
|
8600
|
-
callAngularRouter(hrefMarkdownLinkContent) {
|
|
8601
|
-
const urls = hrefMarkdownLinkContent.split('?');
|
|
8602
|
-
const queryParams = urls[1];
|
|
8603
|
-
const queryParamObj = {};
|
|
8604
|
-
if (queryParams) {
|
|
8605
|
-
const queryParam = queryParams.split('&');
|
|
8606
|
-
if (queryParam[0]) {
|
|
8607
|
-
// tslint:disable-next-line: prefer-for-of
|
|
8608
|
-
for (let i = 0; i < queryParam.length; i++) {
|
|
8609
|
-
const param = queryParam[i].split('=');
|
|
8610
|
-
queryParamObj[param[0]] = param[1];
|
|
8611
|
-
}
|
|
8612
|
-
}
|
|
8613
|
-
}
|
|
8614
|
-
this.router.navigate([urls[0]], {
|
|
8615
|
-
queryParams: queryParamObj && (Object.keys(queryParamObj).length) ? queryParamObj : ''
|
|
8616
|
-
});
|
|
8617
|
-
}
|
|
8618
|
-
static ɵfac = function ConvertHrefToRouterService_Factory(t) { return new (t || ConvertHrefToRouterService)(i0.ɵɵinject(i1$1.Router)); };
|
|
8619
|
-
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConvertHrefToRouterService, factory: ConvertHrefToRouterService.ɵfac });
|
|
8620
|
-
}
|
|
8621
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConvertHrefToRouterService, [{
|
|
8622
|
-
type: Injectable
|
|
8623
|
-
}], () => [{ type: i1$1.Router }], null); })();
|
|
8624
|
-
|
|
8625
|
-
class WizardFactoryService {
|
|
8626
|
-
create(eventTrigger) {
|
|
8627
|
-
return new Wizard(eventTrigger.wizard_pages);
|
|
8628
|
-
}
|
|
8629
|
-
}
|
|
8630
|
-
|
|
8631
|
-
class CaseEditWizardGuard {
|
|
8632
|
-
router;
|
|
8633
|
-
routerHelper;
|
|
8634
|
-
wizardFactory;
|
|
8635
|
-
alertService;
|
|
8636
|
-
eventTriggerService;
|
|
8637
|
-
constructor(router, routerHelper, wizardFactory, alertService, eventTriggerService) {
|
|
8638
|
-
this.router = router;
|
|
8639
|
-
this.routerHelper = routerHelper;
|
|
8640
|
-
this.wizardFactory = wizardFactory;
|
|
8641
|
-
this.alertService = alertService;
|
|
8642
|
-
this.eventTriggerService = eventTriggerService;
|
|
8643
|
-
}
|
|
8644
|
-
resolve(route) {
|
|
8645
|
-
this.eventTriggerService.eventTriggerSource.asObservable().pipe(first()).subscribe(eventTrigger => {
|
|
8646
|
-
this.processEventTrigger(route, eventTrigger);
|
|
8647
|
-
});
|
|
8648
|
-
if (route.parent.data.eventTrigger) {
|
|
8649
|
-
this.eventTriggerService.announceEventTrigger(route.parent.data.eventTrigger);
|
|
8650
|
-
}
|
|
8651
|
-
return Promise.resolve(true);
|
|
8652
|
-
}
|
|
8653
|
-
processEventTrigger(route, eventTrigger) {
|
|
8654
|
-
if (!eventTrigger.hasFields() || !eventTrigger.hasPages()) {
|
|
8655
|
-
this.goToSubmit(route);
|
|
8656
|
-
return Promise.resolve(false);
|
|
8657
|
-
}
|
|
8658
|
-
const wizard = this.wizardFactory.create(eventTrigger);
|
|
8659
|
-
const currentState = this.buildState(eventTrigger.case_fields);
|
|
8660
|
-
// TODO Extract predicate and state creation in a factory
|
|
8661
|
-
const canShowPredicate = (page) => {
|
|
8662
|
-
return ShowCondition.getInstance(page.show_condition).match(currentState);
|
|
8663
|
-
};
|
|
8664
|
-
if (!route.params['page']) {
|
|
8665
|
-
this.goToFirst(wizard, canShowPredicate, route);
|
|
8666
|
-
return Promise.resolve(false);
|
|
8230
|
+
if (!route.params['page']) {
|
|
8231
|
+
this.goToFirst(wizard, canShowPredicate, route);
|
|
8232
|
+
return Promise.resolve(false);
|
|
8667
8233
|
}
|
|
8668
8234
|
const pageId = route.params['page'];
|
|
8669
8235
|
if (!wizard.hasPage(pageId)) {
|
|
@@ -8896,7 +8462,7 @@ class EventCompletionStateMachineService {
|
|
|
8896
8462
|
entryActionForStateCompleteEventAndTask(state, context) {
|
|
8897
8463
|
// Trigger final state to complete processing of state machine
|
|
8898
8464
|
state.trigger(EventCompletionStates.Final);
|
|
8899
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8465
|
+
const clientContextStr = context.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
8900
8466
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8901
8467
|
if (userTask?.task_data) {
|
|
8902
8468
|
context.sessionStorageService.setItem('assignNeeded', 'false');
|
|
@@ -8917,7 +8483,7 @@ class EventCompletionStateMachineService {
|
|
|
8917
8483
|
entryActionForStateTaskUnassigned(state, context) {
|
|
8918
8484
|
// Trigger final state to complete processing of state machine
|
|
8919
8485
|
state.trigger(EventCompletionStates.Final);
|
|
8920
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8486
|
+
const clientContextStr = context.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
8921
8487
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8922
8488
|
if (userTask?.task_data) {
|
|
8923
8489
|
context.sessionStorageService.setItem('assignNeeded', 'true');
|
|
@@ -8955,7 +8521,7 @@ class EventCompletionStateMachineService {
|
|
|
8955
8521
|
this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
|
|
8956
8522
|
}
|
|
8957
8523
|
taskPresentInSessionStorage(context) {
|
|
8958
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8524
|
+
const clientContextStr = context.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
8959
8525
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8960
8526
|
return !!userTask.task_data;
|
|
8961
8527
|
}
|
|
@@ -9318,8 +8884,11 @@ class CaseEditComponent {
|
|
|
9318
8884
|
workAllocationService;
|
|
9319
8885
|
alertService;
|
|
9320
8886
|
abstractConfig;
|
|
8887
|
+
cookieService;
|
|
9321
8888
|
static ORIGIN_QUERY_PARAM = 'origin';
|
|
9322
8889
|
static ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
|
|
8890
|
+
static CLIENT_CONTEXT = 'clientContext';
|
|
8891
|
+
static TASK_EVENT_COMPLETION_INFO = 'taskEventCompletionInfo';
|
|
9323
8892
|
eventTrigger;
|
|
9324
8893
|
submit;
|
|
9325
8894
|
validate;
|
|
@@ -9343,7 +8912,7 @@ class CaseEditComponent {
|
|
|
9343
8912
|
error;
|
|
9344
8913
|
callbackErrorsSubject = new Subject();
|
|
9345
8914
|
validPageList = [];
|
|
9346
|
-
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig) {
|
|
8915
|
+
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig, cookieService) {
|
|
9347
8916
|
this.fb = fb;
|
|
9348
8917
|
this.caseNotifier = caseNotifier;
|
|
9349
8918
|
this.router = router;
|
|
@@ -9361,6 +8930,7 @@ class CaseEditComponent {
|
|
|
9361
8930
|
this.workAllocationService = workAllocationService;
|
|
9362
8931
|
this.alertService = alertService;
|
|
9363
8932
|
this.abstractConfig = abstractConfig;
|
|
8933
|
+
this.cookieService = cookieService;
|
|
9364
8934
|
}
|
|
9365
8935
|
ngOnInit() {
|
|
9366
8936
|
this.wizard = this.wizardFactory.create(this.eventTrigger);
|
|
@@ -9378,6 +8948,7 @@ class CaseEditComponent {
|
|
|
9378
8948
|
this.route.queryParams.subscribe((params) => {
|
|
9379
8949
|
this.navigationOrigin = params[CaseEditComponent.ORIGIN_QUERY_PARAM];
|
|
9380
8950
|
});
|
|
8951
|
+
removeTaskFromClientContext(this.sessionStorageService);
|
|
9381
8952
|
}
|
|
9382
8953
|
ngOnDestroy() {
|
|
9383
8954
|
/* istanbul ignore else */
|
|
@@ -9467,12 +9038,12 @@ class CaseEditComponent {
|
|
|
9467
9038
|
this.isSubmitting = true;
|
|
9468
9039
|
// We have to run the event completion checks if task in session storage
|
|
9469
9040
|
// and if the task is in session storage, then is it associated to the case
|
|
9470
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
9041
|
+
const clientContextStr = this.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
9471
9042
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9472
9043
|
const taskInSessionStorage = userTask ? userTask.task_data : null;
|
|
9473
9044
|
let taskEventCompletionInfo;
|
|
9474
9045
|
let userInfo;
|
|
9475
|
-
const taskEventCompletionStr = this.sessionStorageService.getItem(
|
|
9046
|
+
const taskEventCompletionStr = this.sessionStorageService.getItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO);
|
|
9476
9047
|
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
9477
9048
|
const assignNeeded = this.sessionStorageService.getItem('assignNeeded');
|
|
9478
9049
|
if (taskEventCompletionStr) {
|
|
@@ -9502,7 +9073,7 @@ class CaseEditComponent {
|
|
|
9502
9073
|
taskId: taskInSessionStorage.id,
|
|
9503
9074
|
createdTimestamp: Date.now()
|
|
9504
9075
|
};
|
|
9505
|
-
this.sessionStorageService.setItem(
|
|
9076
|
+
this.sessionStorageService.setItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO, JSON.stringify(taskEventCompletionInfo));
|
|
9506
9077
|
this.isEventCompletionChecksRequired = true;
|
|
9507
9078
|
}
|
|
9508
9079
|
else {
|
|
@@ -9674,8 +9245,9 @@ class CaseEditComponent {
|
|
|
9674
9245
|
}), finalize(() => {
|
|
9675
9246
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9676
9247
|
// on event completion ensure the previous event clientContext/taskEventCompletionInfo removed
|
|
9677
|
-
|
|
9678
|
-
this.sessionStorageService.removeItem(
|
|
9248
|
+
// Note - Not removeTaskFromClientContext because could interfere with other logic
|
|
9249
|
+
this.sessionStorageService.removeItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
9250
|
+
this.sessionStorageService.removeItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO);
|
|
9679
9251
|
this.isSubmitting = false;
|
|
9680
9252
|
}))
|
|
9681
9253
|
.subscribe(() => {
|
|
@@ -9703,7 +9275,7 @@ class CaseEditComponent {
|
|
|
9703
9275
|
});
|
|
9704
9276
|
}
|
|
9705
9277
|
postCompleteTaskIfRequired() {
|
|
9706
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
9278
|
+
const clientContextStr = this.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
9707
9279
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9708
9280
|
const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
|
|
9709
9281
|
const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
|
|
@@ -9717,109 +9289,569 @@ class CaseEditComponent {
|
|
|
9717
9289
|
}
|
|
9718
9290
|
return of(true);
|
|
9719
9291
|
}
|
|
9720
|
-
finishEventCompletionLogic(eventResponse) {
|
|
9721
|
-
this.caseNotifier.cachedCaseView = null;
|
|
9722
|
-
this.sessionStorageService.removeItem('eventUrl');
|
|
9723
|
-
const confirmation = this.buildConfirmation(eventResponse);
|
|
9724
|
-
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
9725
|
-
this.confirm(confirmation);
|
|
9292
|
+
finishEventCompletionLogic(eventResponse) {
|
|
9293
|
+
this.caseNotifier.cachedCaseView = null;
|
|
9294
|
+
this.sessionStorageService.removeItem('eventUrl');
|
|
9295
|
+
const confirmation = this.buildConfirmation(eventResponse);
|
|
9296
|
+
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
9297
|
+
this.confirm(confirmation);
|
|
9298
|
+
}
|
|
9299
|
+
else {
|
|
9300
|
+
this.emitSubmitted(eventResponse);
|
|
9301
|
+
}
|
|
9302
|
+
}
|
|
9303
|
+
buildConfirmation(response) {
|
|
9304
|
+
if (response['after_submit_callback_response']) {
|
|
9305
|
+
return new Confirmation(response['id'], response['callback_response_status'], response['after_submit_callback_response']['confirmation_header'], response['after_submit_callback_response']['confirmation_body']);
|
|
9306
|
+
}
|
|
9307
|
+
else {
|
|
9308
|
+
return null;
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
// checks whether current clientContext relevant for the event
|
|
9312
|
+
taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails) {
|
|
9313
|
+
if (!taskInSessionStorage || taskInSessionStorage.case_id !== eventDetails.caseId) {
|
|
9314
|
+
return false;
|
|
9315
|
+
}
|
|
9316
|
+
if (!taskEventCompletionInfo) {
|
|
9317
|
+
// if no task event present then there is no task to complete from previous event present
|
|
9318
|
+
// EXUI-2668 - Add additional logic to confirm the task is relevant to the event
|
|
9319
|
+
if (this.taskIsForEvent(taskInSessionStorage, eventDetails)) {
|
|
9320
|
+
return true;
|
|
9321
|
+
}
|
|
9322
|
+
else {
|
|
9323
|
+
// client context still needed for language
|
|
9324
|
+
removeTaskFromClientContext(this.sessionStorageService);
|
|
9325
|
+
return false;
|
|
9326
|
+
}
|
|
9327
|
+
}
|
|
9328
|
+
else {
|
|
9329
|
+
if (taskEventCompletionInfo.taskId !== taskInSessionStorage.id) {
|
|
9330
|
+
return true;
|
|
9331
|
+
}
|
|
9332
|
+
else if ((taskEventCompletionInfo.taskId === taskInSessionStorage.id &&
|
|
9333
|
+
this.eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails))
|
|
9334
|
+
|| this.eventMoreThanDayAgo(taskEventCompletionInfo.createdTimestamp)) {
|
|
9335
|
+
// if the session storage not related to event, ignore it and remove
|
|
9336
|
+
removeTaskFromClientContext(this.sessionStorageService);
|
|
9337
|
+
this.sessionStorageService.removeItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO);
|
|
9338
|
+
return false;
|
|
9339
|
+
}
|
|
9340
|
+
if (eventDetails.assignNeeded === 'false' && eventDetails.userId !== taskInSessionStorage.assignee) {
|
|
9341
|
+
// if the user does not match task assignee, assign is now needed
|
|
9342
|
+
// data cannot be deleted and ignored as it matches understanding
|
|
9343
|
+
this.sessionStorageService.setItem('assignNeeded', 'true');
|
|
9344
|
+
}
|
|
9345
|
+
return true;
|
|
9346
|
+
}
|
|
9347
|
+
}
|
|
9348
|
+
onEventCanBeCompleted({ eventTrigger, eventCanBeCompleted, caseDetails, form, submit }) {
|
|
9349
|
+
if (eventCanBeCompleted) {
|
|
9350
|
+
// Submit
|
|
9351
|
+
const caseEventData = this.generateCaseEventData({ eventTrigger, form });
|
|
9352
|
+
this.caseSubmit({ form, caseEventData, submit });
|
|
9353
|
+
}
|
|
9354
|
+
else {
|
|
9355
|
+
// Navigate to tasks tab on case details page
|
|
9356
|
+
this.router.navigate([`/cases/case-details/${this.getCaseId(caseDetails)}/tasks`], { relativeTo: this.route });
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
getStatus(response) {
|
|
9360
|
+
return this.hasCallbackFailed(response) ? response['callback_response_status'] : response['delete_draft_response_status'];
|
|
9361
|
+
}
|
|
9362
|
+
hasCallbackFailed(response) {
|
|
9363
|
+
return response['callback_response_status'] !== 'CALLBACK_COMPLETED';
|
|
9364
|
+
}
|
|
9365
|
+
eventMoreThanDayAgo(timestamp) {
|
|
9366
|
+
if ((new Date().getTime() - timestamp) > (24 * 60 * 60 * 1000)) {
|
|
9367
|
+
return true;
|
|
9368
|
+
}
|
|
9369
|
+
return false;
|
|
9370
|
+
}
|
|
9371
|
+
eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails) {
|
|
9372
|
+
if (taskEventCompletionInfo.eventId !== eventDetails.eventId
|
|
9373
|
+
|| taskEventCompletionInfo.caseId !== eventDetails.caseId
|
|
9374
|
+
|| taskEventCompletionInfo.userId !== eventDetails.userId) {
|
|
9375
|
+
return true;
|
|
9376
|
+
}
|
|
9377
|
+
return false;
|
|
9378
|
+
}
|
|
9379
|
+
taskIsForEvent(task, eventDetails) {
|
|
9380
|
+
// EXUI-2668 - Ensure description for task includes event ID
|
|
9381
|
+
// Note - This is a failsafe for an edge case that may never occur again
|
|
9382
|
+
// Description may not include eventId in some cases which may mean task not completed (however this will be easy to check)
|
|
9383
|
+
this.abstractConfig.logMessage(`checking taskIsForEvent: task ID ${task.id}, task description ${task.description}, event name ${eventDetails.eventId}`);
|
|
9384
|
+
return task.case_id === eventDetails.caseId && (task.description && task.description.includes(eventDetails.eventId));
|
|
9385
|
+
}
|
|
9386
|
+
static ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i4.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(ReadCookieService)); };
|
|
9387
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) { if (rf & 1) {
|
|
9388
|
+
i0.ɵɵelement(0, "router-outlet");
|
|
9389
|
+
} }, dependencies: [i1$1.RouterOutlet], styles: ["#fieldset-case-data[_ngcontent-%COMP%]{margin-bottom:30px}#fieldset-case-data[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{width:1%;white-space:nowrap;vertical-align:top}.compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:0}#confirmation-header[_ngcontent-%COMP%]{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body[_ngcontent-%COMP%]{width:630px;background-color:#fff}.valign-top[_ngcontent-%COMP%]{vertical-align:top}.summary-fields[_ngcontent-%COMP%]{margin-bottom:30px}.summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:0px}a.disabled[_ngcontent-%COMP%]{pointer-events:none;cursor:default}.case-field-label[_ngcontent-%COMP%]{width:45%}.case-field-content[_ngcontent-%COMP%]{width:50%}.no-bottom-border[_ngcontent-%COMP%]{border-bottom:none}.case-field-change[_ngcontent-%COMP%]{width:5%}"] });
|
|
9390
|
+
}
|
|
9391
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
|
|
9392
|
+
type: Component,
|
|
9393
|
+
args: [{ selector: 'ccd-case-edit', providers: [GreyBarService], template: "<router-outlet></router-outlet>\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.no-bottom-border{border-bottom:none}.case-field-change{width:5%}\n"] }]
|
|
9394
|
+
}], () => [{ type: i4.FormBuilder }, { type: CaseNotifier }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: WorkAllocationService }, { type: AlertService }, { type: AbstractAppConfig }, { type: ReadCookieService }], { eventTrigger: [{
|
|
9395
|
+
type: Input
|
|
9396
|
+
}], submit: [{
|
|
9397
|
+
type: Input
|
|
9398
|
+
}], validate: [{
|
|
9399
|
+
type: Input
|
|
9400
|
+
}], saveDraft: [{
|
|
9401
|
+
type: Input
|
|
9402
|
+
}], caseDetails: [{
|
|
9403
|
+
type: Input
|
|
9404
|
+
}], cancelled: [{
|
|
9405
|
+
type: Output
|
|
9406
|
+
}], submitted: [{
|
|
9407
|
+
type: Output
|
|
9408
|
+
}] }); })();
|
|
9409
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 37 }); })();
|
|
9410
|
+
|
|
9411
|
+
function convertNonASCIICharacter(character) {
|
|
9412
|
+
if (character === '£') {
|
|
9413
|
+
// pound sign will be frequently used and works for btoa despite being non-ASCII
|
|
9414
|
+
// note: this could be done for other characters provided they work for btoa()
|
|
9415
|
+
return character;
|
|
9416
|
+
}
|
|
9417
|
+
// Note: Will convert to HTML entity
|
|
9418
|
+
return CaseEditUtils.PREFIX + character.charCodeAt(0) + CaseEditUtils.SUFFIX;
|
|
9419
|
+
}
|
|
9420
|
+
class CaseEditUtils {
|
|
9421
|
+
static PREFIX = '&#';
|
|
9422
|
+
static SUFFIX = ';';
|
|
9423
|
+
convertNonASCIICharacters(rawString) {
|
|
9424
|
+
return rawString ? rawString.replace(/[^\x20-\x7E]/g, function (c) {
|
|
9425
|
+
return convertNonASCIICharacter(c);
|
|
9426
|
+
}) : '';
|
|
9427
|
+
}
|
|
9428
|
+
convertHTMLEntities(editedString) {
|
|
9429
|
+
const revertedCharacterList = editedString.split(CaseEditUtils.PREFIX);
|
|
9430
|
+
let rawString = revertedCharacterList[0];
|
|
9431
|
+
for (let index = 1; index < revertedCharacterList.length; index++) {
|
|
9432
|
+
const currentSection = revertedCharacterList[index];
|
|
9433
|
+
if (!currentSection.includes(CaseEditUtils.SUFFIX)) {
|
|
9434
|
+
return rawString.concat(currentSection);
|
|
9435
|
+
}
|
|
9436
|
+
else {
|
|
9437
|
+
const suffixSplitList = currentSection.split(CaseEditUtils.SUFFIX);
|
|
9438
|
+
const characterCode = Number(suffixSplitList[0]);
|
|
9439
|
+
rawString = rawString.concat(String.fromCharCode(characterCode), suffixSplitList[1]);
|
|
9440
|
+
}
|
|
9441
|
+
}
|
|
9442
|
+
return rawString;
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
function removeTaskFromClientContext(sessionStorageService) {
|
|
9446
|
+
if (!sessionStorageService) {
|
|
9447
|
+
return;
|
|
9448
|
+
}
|
|
9449
|
+
const clientContextString = sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
9450
|
+
const clientContext = clientContextString ? JSON.parse(clientContextString) : null;
|
|
9451
|
+
if (clientContext?.client_context?.user_task) {
|
|
9452
|
+
delete clientContext.client_context.user_task;
|
|
9453
|
+
sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(clientContext));
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9456
|
+
|
|
9457
|
+
class CasesService {
|
|
9458
|
+
http;
|
|
9459
|
+
appConfig;
|
|
9460
|
+
orderService;
|
|
9461
|
+
errorService;
|
|
9462
|
+
wizardPageFieldToCaseFieldMapper;
|
|
9463
|
+
loadingService;
|
|
9464
|
+
sessionStorageService;
|
|
9465
|
+
retryUtil;
|
|
9466
|
+
// Internal (UI) API
|
|
9467
|
+
static V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
|
|
9468
|
+
static V2_MEDIATYPE_START_CASE_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-case-trigger.v2+json;charset=UTF-8';
|
|
9469
|
+
static V2_MEDIATYPE_START_EVENT_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-event-trigger.v2+json;charset=UTF-8';
|
|
9470
|
+
static V2_MEDIATYPE_START_DRAFT_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-draft-trigger.v2+json;charset=UTF-8';
|
|
9471
|
+
// External (Data Store) API
|
|
9472
|
+
static V2_MEDIATYPE_CASE_DOCUMENTS = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.case-documents.v2+json;charset=UTF-8';
|
|
9473
|
+
static V2_MEDIATYPE_CASE_DATA_VALIDATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.case-data-validate.v2+json;charset=UTF-8';
|
|
9474
|
+
static V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
9475
|
+
static V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
9476
|
+
static PUI_CASE_MANAGER = 'pui-case-manager';
|
|
9477
|
+
get = this.getCaseView;
|
|
9478
|
+
static updateChallengedAccessRequestAttributes(httpClient, caseId, attributesToUpdate) {
|
|
9479
|
+
return httpClient.post(`/api/challenged-access-request/update-attributes`, {
|
|
9480
|
+
caseId,
|
|
9481
|
+
attributesToUpdate
|
|
9482
|
+
});
|
|
9483
|
+
}
|
|
9484
|
+
static updateSpecificAccessRequestAttributes(httpClient, caseId, attributesToUpdate) {
|
|
9485
|
+
return httpClient.post(`/api/specific-access-request/update-attributes`, {
|
|
9486
|
+
caseId,
|
|
9487
|
+
attributesToUpdate
|
|
9488
|
+
});
|
|
9489
|
+
}
|
|
9490
|
+
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService, retryUtil) {
|
|
9491
|
+
this.http = http;
|
|
9492
|
+
this.appConfig = appConfig;
|
|
9493
|
+
this.orderService = orderService;
|
|
9494
|
+
this.errorService = errorService;
|
|
9495
|
+
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
9496
|
+
this.loadingService = loadingService;
|
|
9497
|
+
this.sessionStorageService = sessionStorageService;
|
|
9498
|
+
this.retryUtil = retryUtil;
|
|
9499
|
+
}
|
|
9500
|
+
getCaseView(jurisdictionId, caseTypeId, caseId) {
|
|
9501
|
+
const url = `${this.appConfig.getApiUrl()}/caseworkers/:uid/jurisdictions/${jurisdictionId}/case-types/${caseTypeId}/cases/${caseId}`;
|
|
9502
|
+
const loadingToken = this.loadingService.register();
|
|
9503
|
+
return this.http
|
|
9504
|
+
.get(url)
|
|
9505
|
+
.pipe(catchError(error => {
|
|
9506
|
+
this.errorService.setError(error);
|
|
9507
|
+
return throwError(error);
|
|
9508
|
+
}), finalize(() => this.loadingService.unregister(loadingToken)));
|
|
9509
|
+
}
|
|
9510
|
+
getCaseViewV2(caseId) {
|
|
9511
|
+
const url = `${this.appConfig.getCaseDataUrl()}/internal/cases/${caseId}`;
|
|
9512
|
+
const headers = new HttpHeaders()
|
|
9513
|
+
.set('experimental', 'true')
|
|
9514
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CASE_VIEW)
|
|
9515
|
+
.set('Content-Type', 'application/json');
|
|
9516
|
+
const loadingToken = this.loadingService.register();
|
|
9517
|
+
let http$ = this.http.get(url, { headers, observe: 'body' });
|
|
9518
|
+
const artificialDelay = this.appConfig.getTimeoutsCaseRetrievalArtificialDelay();
|
|
9519
|
+
const timeoutPeriods = this.appConfig.getTimeoutsForCaseRetrieval();
|
|
9520
|
+
console.log(`Timeout periods: ${timeoutPeriods} seconds.`);
|
|
9521
|
+
if (timeoutPeriods && timeoutPeriods.length > 0 && timeoutPeriods[0] > 0) {
|
|
9522
|
+
http$ = this.retryUtil.pipeTimeoutMechanismOn(http$, artificialDelay, timeoutPeriods);
|
|
9523
|
+
}
|
|
9524
|
+
else {
|
|
9525
|
+
console.warn('Skipping to pipe a retry mechanism!');
|
|
9526
|
+
}
|
|
9527
|
+
http$ = this.pipeErrorProcessor(http$);
|
|
9528
|
+
http$ = http$.pipe(finalize(() => this.finalizeGetCaseViewWith(caseId, loadingToken)));
|
|
9529
|
+
return http$;
|
|
9530
|
+
}
|
|
9531
|
+
pipeErrorProcessor(in$) {
|
|
9532
|
+
const out$ = in$.pipe(catchError(error => {
|
|
9533
|
+
console.error(`Error while getting case view with getCaseViewV2! Error type: '${typeof error}, Error name: '${error?.name}'`);
|
|
9534
|
+
console.error(error);
|
|
9535
|
+
this.errorService.setError(error);
|
|
9536
|
+
return throwError(error);
|
|
9537
|
+
}));
|
|
9538
|
+
return out$;
|
|
9539
|
+
}
|
|
9540
|
+
finalizeGetCaseViewWith(caseId, loadingToken) {
|
|
9541
|
+
this.loadingService.unregister(loadingToken);
|
|
9542
|
+
}
|
|
9543
|
+
syncWait(seconds) {
|
|
9544
|
+
const end = Date.now() + seconds * 1000;
|
|
9545
|
+
while (Date.now() < end)
|
|
9546
|
+
continue;
|
|
9547
|
+
}
|
|
9548
|
+
getEventTrigger(caseTypeId, eventTriggerId, caseId, ignoreWarning) {
|
|
9549
|
+
ignoreWarning = undefined !== ignoreWarning ? ignoreWarning : 'false';
|
|
9550
|
+
const url = this.buildEventTriggerUrl(caseTypeId, eventTriggerId, caseId, ignoreWarning);
|
|
9551
|
+
let headers = new HttpHeaders();
|
|
9552
|
+
headers = headers.set('experimental', 'true');
|
|
9553
|
+
headers = headers.set('Content-Type', 'application/json');
|
|
9554
|
+
headers = this.addClientContextHeader(headers);
|
|
9555
|
+
if (Draft.isDraft(caseId)) {
|
|
9556
|
+
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
|
|
9557
|
+
}
|
|
9558
|
+
else if (caseId !== undefined && caseId !== null) {
|
|
9559
|
+
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_EVENT_TRIGGER);
|
|
9560
|
+
}
|
|
9561
|
+
else {
|
|
9562
|
+
headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
|
|
9563
|
+
}
|
|
9564
|
+
return this.http
|
|
9565
|
+
.get(url, { headers, observe: 'response' })
|
|
9566
|
+
.pipe(map((response) => {
|
|
9567
|
+
this.updateClientContextStorage(response.headers);
|
|
9568
|
+
return FieldsUtils.handleNestedDynamicLists(response.body);
|
|
9569
|
+
}), catchError(error => {
|
|
9570
|
+
this.errorService.setError(error);
|
|
9571
|
+
return throwError(error);
|
|
9572
|
+
}), map((p) => plainToClass(CaseEventTrigger, p)), tap(eventTrigger => this.initialiseEventTrigger(eventTrigger)));
|
|
9573
|
+
}
|
|
9574
|
+
createEvent(caseDetails, eventData) {
|
|
9575
|
+
const caseId = caseDetails.case_id;
|
|
9576
|
+
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
|
|
9577
|
+
let headers = new HttpHeaders()
|
|
9578
|
+
.set('experimental', 'true')
|
|
9579
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
|
|
9580
|
+
.set('Content-Type', 'application/json');
|
|
9581
|
+
headers = this.addClientContextHeader(headers);
|
|
9582
|
+
return this.http
|
|
9583
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
9584
|
+
.pipe(map((response) => {
|
|
9585
|
+
this.updateClientContextStorage(response.headers);
|
|
9586
|
+
return response.body;
|
|
9587
|
+
}), catchError(error => {
|
|
9588
|
+
this.errorService.setError(error);
|
|
9589
|
+
return throwError(error);
|
|
9590
|
+
}));
|
|
9591
|
+
}
|
|
9592
|
+
validateCase(ctid, eventData, pageId) {
|
|
9593
|
+
const pageIdString = pageId ? `?pageId=${pageId}` : '';
|
|
9594
|
+
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
|
|
9595
|
+
let headers = new HttpHeaders()
|
|
9596
|
+
.set('experimental', 'true')
|
|
9597
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
|
|
9598
|
+
.set('Content-Type', 'application/json');
|
|
9599
|
+
headers = this.addClientContextHeader(headers);
|
|
9600
|
+
return this.http
|
|
9601
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
9602
|
+
.pipe(map((response) => {
|
|
9603
|
+
this.updateClientContextStorage(response.headers);
|
|
9604
|
+
return response.body;
|
|
9605
|
+
}), catchError(error => {
|
|
9606
|
+
this.errorService.setError(error);
|
|
9607
|
+
return throwError(error);
|
|
9608
|
+
}));
|
|
9609
|
+
}
|
|
9610
|
+
createCase(ctid, eventData) {
|
|
9611
|
+
let ignoreWarning = 'false';
|
|
9612
|
+
if (eventData.ignore_warning) {
|
|
9613
|
+
ignoreWarning = 'true';
|
|
9614
|
+
}
|
|
9615
|
+
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
|
|
9616
|
+
let headers = new HttpHeaders()
|
|
9617
|
+
.set('experimental', 'true')
|
|
9618
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
|
|
9619
|
+
.set('Content-Type', 'application/json');
|
|
9620
|
+
headers = this.addClientContextHeader(headers);
|
|
9621
|
+
return this.http
|
|
9622
|
+
.post(url, eventData, { headers, observe: 'response' })
|
|
9623
|
+
.pipe(map((response) => {
|
|
9624
|
+
this.updateClientContextStorage(response.headers);
|
|
9625
|
+
return response.body;
|
|
9626
|
+
}), catchError(error => {
|
|
9627
|
+
this.errorService.setError(error);
|
|
9628
|
+
return throwError(error);
|
|
9629
|
+
}));
|
|
9630
|
+
}
|
|
9631
|
+
getPrintDocuments(caseId) {
|
|
9632
|
+
const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
|
|
9633
|
+
let headers = new HttpHeaders()
|
|
9634
|
+
.set('experimental', 'true')
|
|
9635
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
|
|
9636
|
+
.set('Content-Type', 'application/json');
|
|
9637
|
+
headers = this.addClientContextHeader(headers);
|
|
9638
|
+
return this.http
|
|
9639
|
+
.get(url, { headers, observe: 'response' })
|
|
9640
|
+
.pipe(map((response) => {
|
|
9641
|
+
this.updateClientContextStorage(response.headers);
|
|
9642
|
+
return response.body.documentResources;
|
|
9643
|
+
}), catchError(error => {
|
|
9644
|
+
this.errorService.setError(error);
|
|
9645
|
+
return throwError(error);
|
|
9646
|
+
}));
|
|
9647
|
+
}
|
|
9648
|
+
buildEventTriggerUrl(caseTypeId, eventTriggerId, caseId, ignoreWarning) {
|
|
9649
|
+
let url = `${this.appConfig.getCaseDataUrl()}/internal`;
|
|
9650
|
+
if (Draft.isDraft(caseId)) {
|
|
9651
|
+
url += `/drafts/${caseId}`
|
|
9652
|
+
+ `/event-trigger`
|
|
9653
|
+
+ `?ignore-warning=${ignoreWarning}`;
|
|
9654
|
+
}
|
|
9655
|
+
else if (caseTypeId === undefined || caseTypeId === null) {
|
|
9656
|
+
url += `/cases/${caseId}`
|
|
9657
|
+
+ `/event-triggers/${eventTriggerId}`
|
|
9658
|
+
+ `?ignore-warning=${ignoreWarning}`;
|
|
9726
9659
|
}
|
|
9727
9660
|
else {
|
|
9728
|
-
|
|
9661
|
+
url += `/case-types/${caseTypeId}`
|
|
9662
|
+
+ `/event-triggers/${eventTriggerId}`
|
|
9663
|
+
+ `?ignore-warning=${ignoreWarning}`;
|
|
9729
9664
|
}
|
|
9665
|
+
return url;
|
|
9730
9666
|
}
|
|
9731
|
-
|
|
9732
|
-
if (
|
|
9733
|
-
|
|
9734
|
-
}
|
|
9735
|
-
else {
|
|
9736
|
-
return null;
|
|
9667
|
+
initialiseEventTrigger(eventTrigger) {
|
|
9668
|
+
if (!eventTrigger.wizard_pages) {
|
|
9669
|
+
eventTrigger.wizard_pages = [];
|
|
9737
9670
|
}
|
|
9671
|
+
eventTrigger.wizard_pages.forEach((wizardPage) => {
|
|
9672
|
+
wizardPage.parsedShowCondition = ShowCondition.getInstance(wizardPage.show_condition);
|
|
9673
|
+
wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
|
|
9674
|
+
});
|
|
9738
9675
|
}
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9676
|
+
getCourtOrHearingCentreName(locationId) {
|
|
9677
|
+
return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
|
|
9678
|
+
}
|
|
9679
|
+
createChallengedAccessRequest(caseId, request) {
|
|
9680
|
+
// Assignment API endpoint
|
|
9681
|
+
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
9682
|
+
const camUtils = new CaseAccessUtils();
|
|
9683
|
+
let userInfo;
|
|
9684
|
+
if (userInfoStr) {
|
|
9685
|
+
userInfo = JSON.parse(userInfoStr);
|
|
9743
9686
|
}
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9687
|
+
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
9688
|
+
const roleName = camUtils.getAMRoleName('challenged', roleCategory);
|
|
9689
|
+
const beginTime = new Date();
|
|
9690
|
+
const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
|
|
9691
|
+
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
9692
|
+
const isNew = true;
|
|
9693
|
+
const payload = camUtils.getAMPayload(id, id, roleName, roleCategory, 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
|
|
9694
|
+
return this.http.post(`/api/challenged-access-request`, payload);
|
|
9695
|
+
}
|
|
9696
|
+
createSpecificAccessRequest(caseId, sar) {
|
|
9697
|
+
// Assignment API endpoint
|
|
9698
|
+
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
9699
|
+
const camUtils = new CaseAccessUtils();
|
|
9700
|
+
let userInfo;
|
|
9701
|
+
if (userInfoStr) {
|
|
9702
|
+
userInfo = JSON.parse(userInfoStr);
|
|
9747
9703
|
}
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9704
|
+
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
9705
|
+
const roleName = camUtils.getAMRoleName('specific', roleCategory);
|
|
9706
|
+
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
9707
|
+
const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);
|
|
9708
|
+
payload.roleRequest = {
|
|
9709
|
+
...payload.roleRequest,
|
|
9710
|
+
process: 'specific-access',
|
|
9711
|
+
replaceExisting: true,
|
|
9712
|
+
assignerId: payload.requestedRoles[0].actorId,
|
|
9713
|
+
reference: `${caseId}/${roleName}/${payload.requestedRoles[0].actorId}`
|
|
9714
|
+
};
|
|
9715
|
+
payload.requestedRoles[0] = {
|
|
9716
|
+
...payload.requestedRoles[0],
|
|
9717
|
+
roleName: 'specific-access-requested',
|
|
9718
|
+
roleCategory,
|
|
9719
|
+
classification: 'PRIVATE',
|
|
9720
|
+
endTime: new Date(new Date().setDate(new Date().getDate() + 30)),
|
|
9721
|
+
beginTime: null,
|
|
9722
|
+
grantType: 'BASIC',
|
|
9723
|
+
readOnly: true
|
|
9724
|
+
};
|
|
9725
|
+
payload.requestedRoles[0].attributes = {
|
|
9726
|
+
...payload.requestedRoles[0].attributes,
|
|
9727
|
+
requestedRole: roleName,
|
|
9728
|
+
specificAccessReason: sar.specificReason
|
|
9729
|
+
};
|
|
9730
|
+
payload.requestedRoles[0].notes[0] = {
|
|
9731
|
+
...payload.requestedRoles[0].notes[0],
|
|
9732
|
+
userId: payload.requestedRoles[0].actorId
|
|
9733
|
+
};
|
|
9734
|
+
return this.http.post(`/api/specific-access-request`, payload);
|
|
9735
|
+
}
|
|
9736
|
+
getLinkedCases(caseId) {
|
|
9737
|
+
const url = `${this.appConfig.getCaseDataStoreApiUrl()}/${caseId}`;
|
|
9738
|
+
return this.http
|
|
9739
|
+
.get(url)
|
|
9740
|
+
.pipe(catchError(error => throwError(error)));
|
|
9741
|
+
}
|
|
9742
|
+
addClientContextHeader(headers) {
|
|
9743
|
+
const clientContextDetails = this.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
9744
|
+
if (clientContextDetails) {
|
|
9745
|
+
const caseEditUtils = new CaseEditUtils();
|
|
9746
|
+
// below changes non-ASCII characters
|
|
9747
|
+
const editedClientContext = caseEditUtils.convertNonASCIICharacters(clientContextDetails);
|
|
9748
|
+
const clientContext = window.btoa(editedClientContext);
|
|
9749
|
+
if (clientContext) {
|
|
9750
|
+
headers = headers.set('Client-Context', clientContext);
|
|
9764
9751
|
}
|
|
9765
|
-
return true;
|
|
9766
9752
|
}
|
|
9753
|
+
return headers;
|
|
9767
9754
|
}
|
|
9768
|
-
|
|
9769
|
-
if (
|
|
9770
|
-
|
|
9771
|
-
const
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
// Navigate to tasks tab on case details page
|
|
9776
|
-
this.router.navigate([`/cases/case-details/${this.getCaseId(caseDetails)}/tasks`], { relativeTo: this.route });
|
|
9755
|
+
updateClientContextStorage(headers) {
|
|
9756
|
+
if (headers && headers.get('Client-Context')) {
|
|
9757
|
+
const caseEditUtils = new CaseEditUtils();
|
|
9758
|
+
const clientContextString = window.atob(headers.get('Client-Context'));
|
|
9759
|
+
// below reverts non-ASCII characters
|
|
9760
|
+
const editedClientContextString = caseEditUtils.convertHTMLEntities(clientContextString);
|
|
9761
|
+
this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, editedClientContextString);
|
|
9777
9762
|
}
|
|
9778
9763
|
}
|
|
9779
|
-
|
|
9780
|
-
|
|
9764
|
+
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)); };
|
|
9765
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
9766
|
+
}
|
|
9767
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasesService, [{
|
|
9768
|
+
type: Injectable
|
|
9769
|
+
}], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }, { type: RetryUtil }], null); })();
|
|
9770
|
+
|
|
9771
|
+
function CaseCreateComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
9772
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
9773
|
+
i0.ɵɵelementStart(0, "div")(1, "ccd-case-edit", 1);
|
|
9774
|
+
i0.ɵɵlistener("cancelled", function CaseCreateComponent_div_0_Template_ccd_case_edit_cancelled_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.emitCancelled($event)); })("submitted", function CaseCreateComponent_div_0_Template_ccd_case_edit_submitted_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.emitSubmitted($event)); });
|
|
9775
|
+
i0.ɵɵelementEnd()();
|
|
9776
|
+
} if (rf & 2) {
|
|
9777
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
9778
|
+
i0.ɵɵadvance();
|
|
9779
|
+
i0.ɵɵproperty("submit", ctx_r1.submit())("validate", ctx_r1.validate())("saveDraft", ctx_r1.saveDraft())("eventTrigger", ctx_r1.eventTrigger);
|
|
9780
|
+
} }
|
|
9781
|
+
class CaseCreateComponent {
|
|
9782
|
+
casesService;
|
|
9783
|
+
alertService;
|
|
9784
|
+
draftService;
|
|
9785
|
+
eventTriggerService;
|
|
9786
|
+
jurisdiction;
|
|
9787
|
+
caseType;
|
|
9788
|
+
event;
|
|
9789
|
+
cancelled = new EventEmitter();
|
|
9790
|
+
submitted = new EventEmitter();
|
|
9791
|
+
eventTrigger;
|
|
9792
|
+
constructor(casesService, alertService, draftService, eventTriggerService) {
|
|
9793
|
+
this.casesService = casesService;
|
|
9794
|
+
this.alertService = alertService;
|
|
9795
|
+
this.draftService = draftService;
|
|
9796
|
+
this.eventTriggerService = eventTriggerService;
|
|
9781
9797
|
}
|
|
9782
|
-
|
|
9783
|
-
|
|
9798
|
+
ngOnInit() {
|
|
9799
|
+
this.casesService.getEventTrigger(this.caseType, this.event).toPromise()
|
|
9800
|
+
.then(eventTrigger => {
|
|
9801
|
+
this.eventTrigger = eventTrigger;
|
|
9802
|
+
this.eventTriggerService.announceEventTrigger(eventTrigger);
|
|
9803
|
+
})
|
|
9804
|
+
.catch((error) => {
|
|
9805
|
+
this.alertService.error({ phrase: error.message });
|
|
9806
|
+
return throwError(error);
|
|
9807
|
+
});
|
|
9784
9808
|
}
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9809
|
+
submit() {
|
|
9810
|
+
return (sanitizedEditForm) => {
|
|
9811
|
+
sanitizedEditForm.draft_id = this.eventTrigger.case_id;
|
|
9812
|
+
return this.casesService.createCase(this.caseType, sanitizedEditForm);
|
|
9813
|
+
};
|
|
9790
9814
|
}
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9815
|
+
validate() {
|
|
9816
|
+
return (sanitizedEditForm, pageId) => this.casesService
|
|
9817
|
+
.validateCase(this.caseType, sanitizedEditForm, pageId);
|
|
9818
|
+
}
|
|
9819
|
+
saveDraft() {
|
|
9820
|
+
if (this.eventTrigger.can_save_draft) {
|
|
9821
|
+
return (caseEventData) => this.draftService.createOrUpdateDraft(this.caseType, this.eventTrigger.case_id, caseEventData);
|
|
9796
9822
|
}
|
|
9797
|
-
return false;
|
|
9798
9823
|
}
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9824
|
+
emitCancelled(event) {
|
|
9825
|
+
this.cancelled.emit(event);
|
|
9826
|
+
}
|
|
9827
|
+
emitSubmitted(event) {
|
|
9828
|
+
this.submitted.emit(event);
|
|
9829
|
+
}
|
|
9830
|
+
isDataLoaded() {
|
|
9831
|
+
return this.eventTrigger ? true : false;
|
|
9832
|
+
}
|
|
9833
|
+
static ɵfac = function CaseCreateComponent_Factory(t) { return new (t || CaseCreateComponent)(i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(DraftService), i0.ɵɵdirectiveInject(EventTriggerService)); };
|
|
9834
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseCreateComponent, selectors: [["ccd-case-create"]], inputs: { jurisdiction: "jurisdiction", caseType: "caseType", event: "event" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, decls: 1, vars: 1, consts: [[4, "ngIf"], [3, "cancelled", "submitted", "submit", "validate", "saveDraft", "eventTrigger"]], template: function CaseCreateComponent_Template(rf, ctx) { if (rf & 1) {
|
|
9835
|
+
i0.ɵɵtemplate(0, CaseCreateComponent_div_0_Template, 2, 4, "div", 0);
|
|
9836
|
+
} if (rf & 2) {
|
|
9837
|
+
i0.ɵɵproperty("ngIf", ctx.isDataLoaded());
|
|
9838
|
+
} }, encapsulation: 2 });
|
|
9803
9839
|
}
|
|
9804
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
9840
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseCreateComponent, [{
|
|
9805
9841
|
type: Component,
|
|
9806
|
-
args: [{ selector: 'ccd-case-
|
|
9807
|
-
}], () => [{ type:
|
|
9808
|
-
type: Input
|
|
9809
|
-
}], submit: [{
|
|
9810
|
-
type: Input
|
|
9811
|
-
}], validate: [{
|
|
9842
|
+
args: [{ selector: 'ccd-case-create', template: "<div *ngIf=\"isDataLoaded()\">\n <ccd-case-edit [submit]=\"submit()\"\n [validate]=\"validate()\"\n [saveDraft]=\"saveDraft()\"\n [eventTrigger]=\"eventTrigger\"\n (cancelled)=\"emitCancelled($event)\"\n (submitted)=\"emitSubmitted($event)\"></ccd-case-edit>\n</div>" }]
|
|
9843
|
+
}], () => [{ type: CasesService }, { type: AlertService }, { type: DraftService }, { type: EventTriggerService }], { jurisdiction: [{
|
|
9812
9844
|
type: Input
|
|
9813
|
-
}],
|
|
9845
|
+
}], caseType: [{
|
|
9814
9846
|
type: Input
|
|
9815
|
-
}],
|
|
9847
|
+
}], event: [{
|
|
9816
9848
|
type: Input
|
|
9817
9849
|
}], cancelled: [{
|
|
9818
9850
|
type: Output
|
|
9819
9851
|
}], submitted: [{
|
|
9820
9852
|
type: Output
|
|
9821
9853
|
}] }); })();
|
|
9822
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(
|
|
9854
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseCreateComponent, { className: "CaseCreateComponent", filePath: "lib/shared/components/case-editor/case-create/case-create.component.ts", lineNumber: 17 }); })();
|
|
9823
9855
|
|
|
9824
9856
|
function CaseEditConfirmComponent_div_3_Template(rf, ctx) { if (rf & 1) {
|
|
9825
9857
|
i0.ɵɵelement(0, "div");
|
|
@@ -11244,7 +11276,7 @@ class CaseEventCompletionTaskCancelledComponent {
|
|
|
11244
11276
|
}
|
|
11245
11277
|
onContinue() {
|
|
11246
11278
|
// Removes task to complete so event completes without task
|
|
11247
|
-
this.context.sessionStorageService.removeItem(
|
|
11279
|
+
this.context.sessionStorageService.removeItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
11248
11280
|
// may be able to remove this call below since it is now unneccesary
|
|
11249
11281
|
this.notifyEventCompletionCancelled.emit(true);
|
|
11250
11282
|
}
|
|
@@ -11430,7 +11462,7 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11430
11462
|
}
|
|
11431
11463
|
onContinue() {
|
|
11432
11464
|
// Get task details
|
|
11433
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
11465
|
+
const clientContextStr = this.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
11434
11466
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
11435
11467
|
const task = userTask ? userTask.task_data : null;
|
|
11436
11468
|
// not complete_task not utilised here as related to event completion
|
|
@@ -11460,7 +11492,7 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11460
11492
|
}], notifyEventCompletionReassigned: [{
|
|
11461
11493
|
type: Output
|
|
11462
11494
|
}] }); })();
|
|
11463
|
-
(() => { (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:
|
|
11495
|
+
(() => { (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: 16 }); })();
|
|
11464
11496
|
|
|
11465
11497
|
class AddressOption {
|
|
11466
11498
|
description;
|
|
@@ -14247,6 +14279,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14247
14279
|
static UPLOAD_TIMESTAMP = 'upload_timestamp';
|
|
14248
14280
|
static UPLOAD_ERROR_FILE_REQUIRED = 'File required';
|
|
14249
14281
|
static UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
|
|
14282
|
+
static UPLOAD_ERROR_INVALID_FORMAT = 'Document format is not supported';
|
|
14250
14283
|
static UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
|
|
14251
14284
|
static ERROR_UPLOADING_FILE = 'Error Uploading File';
|
|
14252
14285
|
fileInput;
|
|
@@ -14324,8 +14357,15 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14324
14357
|
}
|
|
14325
14358
|
}
|
|
14326
14359
|
}
|
|
14327
|
-
fileChangeEvent(fileInput) {
|
|
14328
|
-
|
|
14360
|
+
fileChangeEvent(fileInput, allowedRegex) {
|
|
14361
|
+
let fileTypeRegex;
|
|
14362
|
+
if (allowedRegex) {
|
|
14363
|
+
fileTypeRegex = new RegExp(`(${allowedRegex.replace(/,/g, '|')})`);
|
|
14364
|
+
}
|
|
14365
|
+
if (fileInput.target?.files[0] && !fileInput.target?.files[0]?.name?.match(fileTypeRegex)) {
|
|
14366
|
+
this.invalidFileFormat();
|
|
14367
|
+
}
|
|
14368
|
+
else if (fileInput.target.files[0]) {
|
|
14329
14369
|
this.selectedFile = fileInput.target.files[0];
|
|
14330
14370
|
this.displayFileUploadMessages(WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS);
|
|
14331
14371
|
const documentUpload = this.buildDocumentUploadData(this.selectedFile);
|
|
@@ -14358,6 +14398,10 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14358
14398
|
}
|
|
14359
14399
|
return false;
|
|
14360
14400
|
}
|
|
14401
|
+
invalidFileFormat() {
|
|
14402
|
+
this.updateDocumentForm(null, null, null);
|
|
14403
|
+
this.displayFileUploadMessages(WriteDocumentFieldComponent.UPLOAD_ERROR_INVALID_FORMAT);
|
|
14404
|
+
}
|
|
14361
14405
|
getUploadedFileName() {
|
|
14362
14406
|
if (this.uploadedDocument) {
|
|
14363
14407
|
return this.uploadedDocument.get(WriteDocumentFieldComponent.DOCUMENT_FILENAME).value;
|
|
@@ -14575,7 +14619,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14575
14619
|
i0.ɵɵlistener("click", function WriteDocumentFieldComponent_Template_div_click_11_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileSelectEvent()); })("keyup", function WriteDocumentFieldComponent_Template_div_keyup_11_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileSelectEvent()); });
|
|
14576
14620
|
i0.ɵɵelementEnd();
|
|
14577
14621
|
i0.ɵɵelementStart(12, "input", 9, 0);
|
|
14578
|
-
i0.ɵɵlistener("keydown.Tab", function WriteDocumentFieldComponent_Template_input_keydown_Tab_12_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileValidationsOnTab()); })("change", function WriteDocumentFieldComponent_Template_input_change_12_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileChangeEvent($event)); });
|
|
14622
|
+
i0.ɵɵlistener("keydown.Tab", function WriteDocumentFieldComponent_Template_input_keydown_Tab_12_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileValidationsOnTab()); })("change", function WriteDocumentFieldComponent_Template_input_change_12_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileChangeEvent($event, ctx.caseField.field_type.regular_expression)); });
|
|
14579
14623
|
i0.ɵɵelementEnd()()();
|
|
14580
14624
|
i0.ɵɵelementStart(14, "div", 10)(15, "button", 11);
|
|
14581
14625
|
i0.ɵɵlistener("click", function WriteDocumentFieldComponent_Template_button_click_15_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.cancelUpload()); });
|
|
@@ -14609,7 +14653,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14609
14653
|
}
|
|
14610
14654
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteDocumentFieldComponent, [{
|
|
14611
14655
|
type: Component,
|
|
14612
|
-
args: [{ selector: 'ccd-write-document-field', template: "<div class=\"form-group\" [ngClass]=\"{'form-group-error bottom-30': !valid}\">\n <label [for]=\"id()\">\n <span class=\"form-label\" attr.aria-label=\"{{caseField | ccdFieldLabel}}\">{{(caseField | ccdFieldLabel)}}</span>\n </label>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"fileUploadMessages && !valid\">{{fileUploadMessages | rpxTranslate}}</span>\n\n <div>\n <!--<span *ngIf=\"getUploadedFileName()\" class=\"text-16\">File name: {{getUploadedFileName()}}</span>-->\n <ccd-read-document-field *ngIf=\"caseField\" [caseField]=\"caseField\"></ccd-read-document-field>\n </div>\n\n <div style='position:relative'>\n <div [id]=\"createElementId('fileInputWrapper')\" (click)=\"fileSelectEvent()\" (keyup)=\"fileSelectEvent()\"></div>\n <input class=\"form-control bottom-30\" [id]=\"id()\" type=\"file\" (keydown.Tab)=\"fileValidationsOnTab()\" (change)=\"fileChangeEvent($event)\"\n accept=\"{{caseField.field_type.regular_expression}}\" #fileInput/>\n </div>\n</div>\n<div class=\"form-group bottom-30\">\n <button class=\"button button-secondary\" type=\"button\" aria-label=\"Cancel upload\" (click)=\"cancelUpload()\" [disabled]=\"!isUploadInProgress()\">{{'Cancel upload' | rpxTranslate}}</button>\n</div>\n" }]
|
|
14656
|
+
args: [{ selector: 'ccd-write-document-field', template: "<div class=\"form-group\" [ngClass]=\"{'form-group-error bottom-30': !valid}\">\n <label [for]=\"id()\">\n <span class=\"form-label\" attr.aria-label=\"{{caseField | ccdFieldLabel}}\">{{(caseField | ccdFieldLabel)}}</span>\n </label>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"fileUploadMessages && !valid\">{{fileUploadMessages | rpxTranslate}}</span>\n\n <div>\n <!--<span *ngIf=\"getUploadedFileName()\" class=\"text-16\">File name: {{getUploadedFileName()}}</span>-->\n <ccd-read-document-field *ngIf=\"caseField\" [caseField]=\"caseField\"></ccd-read-document-field>\n </div>\n\n <div style='position:relative'>\n <div [id]=\"createElementId('fileInputWrapper')\" (click)=\"fileSelectEvent()\" (keyup)=\"fileSelectEvent()\"></div>\n <input class=\"form-control bottom-30\" [id]=\"id()\" type=\"file\" (keydown.Tab)=\"fileValidationsOnTab()\" (change)=\"fileChangeEvent($event, caseField.field_type.regular_expression)\"\n accept=\"{{caseField.field_type.regular_expression}}\" #fileInput/>\n </div>\n</div>\n<div class=\"form-group bottom-30\">\n <button class=\"button button-secondary\" type=\"button\" aria-label=\"Cancel upload\" (click)=\"cancelUpload()\" [disabled]=\"!isUploadInProgress()\">{{'Cancel upload' | rpxTranslate}}</button>\n</div>\n" }]
|
|
14613
14657
|
}], () => [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatLegacyDialog }, { type: FileUploadStateService }, { type: JurisdictionService }], { fileInput: [{
|
|
14614
14658
|
type: ViewChild,
|
|
14615
14659
|
args: ['fileInput', { static: false }]
|
|
@@ -34290,7 +34334,6 @@ class EventStartGuard {
|
|
|
34290
34334
|
sessionStorageService;
|
|
34291
34335
|
abstractConfig;
|
|
34292
34336
|
cookieService;
|
|
34293
|
-
static CLIENT_CONTEXT = 'clientContext';
|
|
34294
34337
|
constructor(workAllocationService, router, sessionStorageService, abstractConfig, cookieService) {
|
|
34295
34338
|
this.workAllocationService = workAllocationService;
|
|
34296
34339
|
this.router = router;
|
|
@@ -34311,7 +34354,7 @@ class EventStartGuard {
|
|
|
34311
34354
|
const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
|
|
34312
34355
|
const languageCookie = this.cookieService.getCookie('exui-preferred-language');
|
|
34313
34356
|
const currentLanguage = !!languageCookie && languageCookie !== '' ? languageCookie : 'en';
|
|
34314
|
-
const preClientContext = this.sessionStorageService.getItem(
|
|
34357
|
+
const preClientContext = this.sessionStorageService.getItem(CaseEditComponent.CLIENT_CONTEXT);
|
|
34315
34358
|
if (!preClientContext) {
|
|
34316
34359
|
// creates client context for language if not already existing
|
|
34317
34360
|
const storeClientContext = {
|
|
@@ -34321,7 +34364,7 @@ class EventStartGuard {
|
|
|
34321
34364
|
}
|
|
34322
34365
|
}
|
|
34323
34366
|
};
|
|
34324
|
-
this.sessionStorageService.setItem(
|
|
34367
|
+
this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34325
34368
|
}
|
|
34326
34369
|
else {
|
|
34327
34370
|
const clientContextObj = JSON.parse(preClientContext);
|
|
@@ -34335,7 +34378,7 @@ class EventStartGuard {
|
|
|
34335
34378
|
}
|
|
34336
34379
|
}
|
|
34337
34380
|
};
|
|
34338
|
-
this.sessionStorageService.setItem(
|
|
34381
|
+
this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(clientContextAddLanguage));
|
|
34339
34382
|
}
|
|
34340
34383
|
}
|
|
34341
34384
|
if (caseInfoStr) {
|
|
@@ -34396,13 +34439,10 @@ class EventStartGuard {
|
|
|
34396
34439
|
}
|
|
34397
34440
|
}
|
|
34398
34441
|
};
|
|
34399
|
-
this.sessionStorageService.setItem(
|
|
34442
|
+
this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34400
34443
|
return true;
|
|
34401
34444
|
}
|
|
34402
34445
|
}
|
|
34403
|
-
removeTaskFromSessionStorage() {
|
|
34404
|
-
this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
|
|
34405
|
-
}
|
|
34406
34446
|
checkForTasks(payload, caseId, eventId, taskId, userId) {
|
|
34407
34447
|
if (taskId && payload?.tasks?.length > 0) {
|
|
34408
34448
|
const task = payload.tasks.find((t) => t.id == taskId);
|
|
@@ -34427,11 +34467,11 @@ class EventStartGuard {
|
|
|
34427
34467
|
}
|
|
34428
34468
|
}
|
|
34429
34469
|
};
|
|
34430
|
-
this.sessionStorageService.setItem(
|
|
34431
|
-
this.sessionStorageService.setItem(
|
|
34470
|
+
this.sessionStorageService.setItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO, JSON.stringify(taskEventCompletionInfo));
|
|
34471
|
+
this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34432
34472
|
}
|
|
34433
34473
|
else {
|
|
34434
|
-
this.
|
|
34474
|
+
removeTaskFromClientContext(this.sessionStorageService);
|
|
34435
34475
|
}
|
|
34436
34476
|
}
|
|
34437
34477
|
if (payload.task_required_for_event) {
|
|
@@ -34610,7 +34650,6 @@ class EventStartStateMachineService {
|
|
|
34610
34650
|
}
|
|
34611
34651
|
}
|
|
34612
34652
|
};
|
|
34613
|
-
context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
|
|
34614
34653
|
let userInfo;
|
|
34615
34654
|
const userInfoStr = context.sessionStorageService.getItem('userDetails');
|
|
34616
34655
|
if (userInfoStr) {
|
|
@@ -34624,7 +34663,9 @@ class EventStartStateMachineService {
|
|
|
34624
34663
|
taskId: task.id,
|
|
34625
34664
|
createdTimestamp: Date.now()
|
|
34626
34665
|
};
|
|
34627
|
-
context.sessionStorageService.setItem(
|
|
34666
|
+
context.sessionStorageService.setItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO, JSON.stringify(taskEventCompletionInfo));
|
|
34667
|
+
// EXUI-2668 - Only add client context when taskEventCompletionInfo is set - stops auto completing incorrect tasks
|
|
34668
|
+
context.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(clientContext));
|
|
34628
34669
|
// Allow user to perform the event
|
|
34629
34670
|
context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
|
|
34630
34671
|
}
|