@hmcts/ccd-case-ui-toolkit 7.1.28-auto-task-completing-fix → 7.1.28-exui-1832-rc2
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 +15 -37
- package/esm2022/lib/shared/components/case-editor/case-edit-utils/case-edit.utils.mjs +1 -13
- package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.mjs +2 -3
- package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +3 -4
- package/esm2022/lib/shared/components/case-editor/services/cases.service.mjs +3 -4
- package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +4 -5
- package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +13 -10
- package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +3 -5
- package/esm2022/lib/shared/components/palette/base-field/field-write.component.mjs +2 -2
- package/esm2022/lib/shared/components/palette/document/write-document-field.component.mjs +34 -18
- package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +722 -735
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +2 -6
- 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 +0 -2
- 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 +2 -0
- 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 +1 -0
- package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
- package/lib/shared/domain/work-allocation/Task.d.ts +0 -1
- package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8036,142 +8036,354 @@ class WizardPageFieldToCaseFieldMapper {
|
|
|
8036
8036
|
}]
|
|
8037
8037
|
}], null, null); })();
|
|
8038
8038
|
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
constructor(caseId, status, header, body) {
|
|
8045
|
-
this.caseId = caseId;
|
|
8046
|
-
this.status = status;
|
|
8047
|
-
this.header = header;
|
|
8048
|
-
this.body = body;
|
|
8049
|
-
}
|
|
8050
|
-
getCaseId() {
|
|
8051
|
-
return this.caseId;
|
|
8052
|
-
}
|
|
8053
|
-
getStatus() {
|
|
8054
|
-
return this.status;
|
|
8055
|
-
}
|
|
8056
|
-
getHeader() {
|
|
8057
|
-
return this.header;
|
|
8058
|
-
}
|
|
8059
|
-
getBody() {
|
|
8060
|
-
return this.body;
|
|
8039
|
+
function convertNonASCIICharacter(character) {
|
|
8040
|
+
if (character === '£') {
|
|
8041
|
+
// pound sign will be frequently used and works for btoa despite being non-ASCII
|
|
8042
|
+
// note: this could be done for other characters provided they work for btoa()
|
|
8043
|
+
return character;
|
|
8061
8044
|
}
|
|
8045
|
+
// Note: Will convert to HTML entity
|
|
8046
|
+
return CaseEditUtils.PREFIX + character.charCodeAt(0) + CaseEditUtils.SUFFIX;
|
|
8062
8047
|
}
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
})
|
|
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);
|
|
8090
|
-
}
|
|
8091
|
-
firstPage(canShow) {
|
|
8092
|
-
return this.pages.find(page => canShow(page));
|
|
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
|
+
}) : '';
|
|
8093
8055
|
}
|
|
8094
|
-
|
|
8095
|
-
const
|
|
8096
|
-
|
|
8097
|
-
|
|
8056
|
+
convertHTMLEntities(editedString) {
|
|
8057
|
+
const revertedCharacterList = editedString.split(CaseEditUtils.PREFIX);
|
|
8058
|
+
let rawString = revertedCharacterList[0];
|
|
8059
|
+
for (let index = 1; index < revertedCharacterList.length; index++) {
|
|
8060
|
+
const currentSection = revertedCharacterList[index];
|
|
8061
|
+
if (!currentSection.includes(CaseEditUtils.SUFFIX)) {
|
|
8062
|
+
return rawString.concat(currentSection);
|
|
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
|
+
}
|
|
8098
8069
|
}
|
|
8099
|
-
return
|
|
8100
|
-
}
|
|
8101
|
-
findWizardPage(caseFieldId) {
|
|
8102
|
-
return this.pages.find(wizardPage => wizardPage.case_fields &&
|
|
8103
|
-
wizardPage.case_fields?.filter(caseField => caseField.id === caseFieldId).length > 0);
|
|
8104
|
-
}
|
|
8105
|
-
nextPage(pageId, canShow) {
|
|
8106
|
-
const currentIndex = this.findExistingIndex(pageId);
|
|
8107
|
-
return this.pages
|
|
8108
|
-
.slice(currentIndex + 1)
|
|
8109
|
-
.find(page => canShow(page));
|
|
8110
|
-
}
|
|
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));
|
|
8070
|
+
return rawString;
|
|
8117
8071
|
}
|
|
8118
|
-
|
|
8119
|
-
|
|
8072
|
+
}
|
|
8073
|
+
|
|
8074
|
+
class CasesService {
|
|
8075
|
+
http;
|
|
8076
|
+
appConfig;
|
|
8077
|
+
orderService;
|
|
8078
|
+
errorService;
|
|
8079
|
+
wizardPageFieldToCaseFieldMapper;
|
|
8080
|
+
loadingService;
|
|
8081
|
+
sessionStorageService;
|
|
8082
|
+
retryUtil;
|
|
8083
|
+
// Internal (UI) API
|
|
8084
|
+
static V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
|
|
8085
|
+
static V2_MEDIATYPE_START_CASE_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-case-trigger.v2+json;charset=UTF-8';
|
|
8086
|
+
static V2_MEDIATYPE_START_EVENT_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-event-trigger.v2+json;charset=UTF-8';
|
|
8087
|
+
static V2_MEDIATYPE_START_DRAFT_TRIGGER = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-start-draft-trigger.v2+json;charset=UTF-8';
|
|
8088
|
+
// External (Data Store) API
|
|
8089
|
+
static V2_MEDIATYPE_CASE_DOCUMENTS = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.case-documents.v2+json;charset=UTF-8';
|
|
8090
|
+
static V2_MEDIATYPE_CASE_DATA_VALIDATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.case-data-validate.v2+json;charset=UTF-8';
|
|
8091
|
+
static V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
8092
|
+
static V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
8093
|
+
static PUI_CASE_MANAGER = 'pui-case-manager';
|
|
8094
|
+
get = this.getCaseView;
|
|
8095
|
+
static updateChallengedAccessRequestAttributes(httpClient, caseId, attributesToUpdate) {
|
|
8096
|
+
return httpClient.post(`/api/challenged-access-request/update-attributes`, {
|
|
8097
|
+
caseId,
|
|
8098
|
+
attributesToUpdate
|
|
8099
|
+
});
|
|
8120
8100
|
}
|
|
8121
|
-
|
|
8122
|
-
return
|
|
8101
|
+
static updateSpecificAccessRequestAttributes(httpClient, caseId, attributesToUpdate) {
|
|
8102
|
+
return httpClient.post(`/api/specific-access-request/update-attributes`, {
|
|
8103
|
+
caseId,
|
|
8104
|
+
attributesToUpdate
|
|
8105
|
+
});
|
|
8123
8106
|
}
|
|
8124
|
-
|
|
8125
|
-
|
|
8107
|
+
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService, retryUtil) {
|
|
8108
|
+
this.http = http;
|
|
8109
|
+
this.appConfig = appConfig;
|
|
8110
|
+
this.orderService = orderService;
|
|
8111
|
+
this.errorService = errorService;
|
|
8112
|
+
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
8113
|
+
this.loadingService = loadingService;
|
|
8114
|
+
this.sessionStorageService = sessionStorageService;
|
|
8115
|
+
this.retryUtil = retryUtil;
|
|
8126
8116
|
}
|
|
8127
|
-
|
|
8128
|
-
|
|
8117
|
+
getCaseView(jurisdictionId, caseTypeId, caseId) {
|
|
8118
|
+
const url = `${this.appConfig.getApiUrl()}/caseworkers/:uid/jurisdictions/${jurisdictionId}/case-types/${caseTypeId}/cases/${caseId}`;
|
|
8119
|
+
const loadingToken = this.loadingService.register();
|
|
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)));
|
|
8129
8126
|
}
|
|
8130
|
-
|
|
8131
|
-
const
|
|
8132
|
-
|
|
8133
|
-
|
|
8127
|
+
getCaseViewV2(caseId) {
|
|
8128
|
+
const url = `${this.appConfig.getCaseDataUrl()}/internal/cases/${caseId}`;
|
|
8129
|
+
const headers = new HttpHeaders()
|
|
8130
|
+
.set('experimental', 'true')
|
|
8131
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CASE_VIEW)
|
|
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);
|
|
8134
8140
|
}
|
|
8135
|
-
|
|
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$;
|
|
8136
8147
|
}
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8148
|
+
pipeErrorProcessor(in$) {
|
|
8149
|
+
const out$ = in$.pipe(catchError(error => {
|
|
8150
|
+
console.error(`Error while getting case view with getCaseViewV2! Error type: '${typeof error}, Error name: '${error?.name}'`);
|
|
8151
|
+
console.error(error);
|
|
8152
|
+
this.errorService.setError(error);
|
|
8153
|
+
return throwError(error);
|
|
8154
|
+
}));
|
|
8155
|
+
return out$;
|
|
8144
8156
|
}
|
|
8145
|
-
|
|
8146
|
-
this.
|
|
8157
|
+
finalizeGetCaseViewWith(caseId, loadingToken) {
|
|
8158
|
+
this.loadingService.unregister(loadingToken);
|
|
8147
8159
|
}
|
|
8148
|
-
|
|
8149
|
-
|
|
8160
|
+
syncWait(seconds) {
|
|
8161
|
+
const end = Date.now() + seconds * 1000;
|
|
8162
|
+
while (Date.now() < end)
|
|
8163
|
+
continue;
|
|
8150
8164
|
}
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
const
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
const param = queryParam[i].split('=');
|
|
8161
|
-
queryParamObj[param[0]] = param[1];
|
|
8162
|
-
}
|
|
8163
|
-
}
|
|
8165
|
+
getEventTrigger(caseTypeId, eventTriggerId, caseId, ignoreWarning) {
|
|
8166
|
+
ignoreWarning = undefined !== ignoreWarning ? ignoreWarning : 'false';
|
|
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);
|
|
8164
8174
|
}
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
}
|
|
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)));
|
|
8168
8190
|
}
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
}
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8191
|
+
createEvent(caseDetails, eventData) {
|
|
8192
|
+
const caseId = caseDetails.case_id;
|
|
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
|
+
}));
|
|
8208
|
+
}
|
|
8209
|
+
validateCase(ctid, eventData, pageId) {
|
|
8210
|
+
const pageIdString = pageId ? `?pageId=${pageId}` : '';
|
|
8211
|
+
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
|
|
8212
|
+
let headers = new HttpHeaders()
|
|
8213
|
+
.set('experimental', 'true')
|
|
8214
|
+
.set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
|
|
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
|
+
}));
|
|
8226
|
+
}
|
|
8227
|
+
createCase(ctid, eventData) {
|
|
8228
|
+
let ignoreWarning = 'false';
|
|
8229
|
+
if (eventData.ignore_warning) {
|
|
8230
|
+
ignoreWarning = 'true';
|
|
8231
|
+
}
|
|
8232
|
+
const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
|
|
8233
|
+
let headers = new HttpHeaders()
|
|
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);
|
|
8312
|
+
}
|
|
8313
|
+
createSpecificAccessRequest(caseId, sar) {
|
|
8314
|
+
// Assignment API endpoint
|
|
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);
|
|
8352
|
+
}
|
|
8353
|
+
getLinkedCases(caseId) {
|
|
8354
|
+
const url = `${this.appConfig.getCaseDataStoreApiUrl()}/${caseId}`;
|
|
8355
|
+
return this.http
|
|
8356
|
+
.get(url)
|
|
8357
|
+
.pipe(catchError(error => throwError(error)));
|
|
8358
|
+
}
|
|
8359
|
+
addClientContextHeader(headers) {
|
|
8360
|
+
const clientContextDetails = this.sessionStorageService.getItem('clientContext');
|
|
8361
|
+
if (clientContextDetails) {
|
|
8362
|
+
const caseEditUtils = new CaseEditUtils();
|
|
8363
|
+
// below changes non-ASCII characters
|
|
8364
|
+
const editedClientContext = caseEditUtils.convertNonASCIICharacters(clientContextDetails);
|
|
8365
|
+
const clientContext = window.btoa(editedClientContext);
|
|
8366
|
+
if (clientContext) {
|
|
8367
|
+
headers = headers.set('Client-Context', clientContext);
|
|
8368
|
+
}
|
|
8369
|
+
}
|
|
8370
|
+
return headers;
|
|
8371
|
+
}
|
|
8372
|
+
updateClientContextStorage(headers) {
|
|
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
|
+
}
|
|
8380
|
+
}
|
|
8381
|
+
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)); };
|
|
8382
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8383
|
+
}
|
|
8384
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasesService, [{
|
|
8385
|
+
type: Injectable
|
|
8386
|
+
}], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }, { type: RetryUtil }], null); })();
|
|
8175
8387
|
|
|
8176
8388
|
class EventTriggerService {
|
|
8177
8389
|
eventTriggerSource = new Subject();
|
|
@@ -8188,44 +8400,266 @@ class EventTriggerService {
|
|
|
8188
8400
|
}]
|
|
8189
8401
|
}], null, null); })();
|
|
8190
8402
|
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
}
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8403
|
+
function CaseCreateComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
8404
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
8405
|
+
i0.ɵɵelementStart(0, "div")(1, "ccd-case-edit", 1);
|
|
8406
|
+
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)); });
|
|
8407
|
+
i0.ɵɵelementEnd()();
|
|
8408
|
+
} if (rf & 2) {
|
|
8409
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
8410
|
+
i0.ɵɵadvance();
|
|
8411
|
+
i0.ɵɵproperty("submit", ctx_r1.submit())("validate", ctx_r1.validate())("saveDraft", ctx_r1.saveDraft())("eventTrigger", ctx_r1.eventTrigger);
|
|
8412
|
+
} }
|
|
8413
|
+
class CaseCreateComponent {
|
|
8414
|
+
casesService;
|
|
8201
8415
|
alertService;
|
|
8416
|
+
draftService;
|
|
8202
8417
|
eventTriggerService;
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8418
|
+
jurisdiction;
|
|
8419
|
+
caseType;
|
|
8420
|
+
event;
|
|
8421
|
+
cancelled = new EventEmitter();
|
|
8422
|
+
submitted = new EventEmitter();
|
|
8423
|
+
eventTrigger;
|
|
8424
|
+
constructor(casesService, alertService, draftService, eventTriggerService) {
|
|
8425
|
+
this.casesService = casesService;
|
|
8207
8426
|
this.alertService = alertService;
|
|
8427
|
+
this.draftService = draftService;
|
|
8208
8428
|
this.eventTriggerService = eventTriggerService;
|
|
8209
8429
|
}
|
|
8210
|
-
|
|
8211
|
-
this.
|
|
8212
|
-
|
|
8430
|
+
ngOnInit() {
|
|
8431
|
+
this.casesService.getEventTrigger(this.caseType, this.event).toPromise()
|
|
8432
|
+
.then(eventTrigger => {
|
|
8433
|
+
this.eventTrigger = eventTrigger;
|
|
8434
|
+
this.eventTriggerService.announceEventTrigger(eventTrigger);
|
|
8435
|
+
})
|
|
8436
|
+
.catch((error) => {
|
|
8437
|
+
this.alertService.error({ phrase: error.message });
|
|
8438
|
+
return throwError(error);
|
|
8213
8439
|
});
|
|
8214
|
-
if (route.parent.data.eventTrigger) {
|
|
8215
|
-
this.eventTriggerService.announceEventTrigger(route.parent.data.eventTrigger);
|
|
8216
|
-
}
|
|
8217
|
-
return Promise.resolve(true);
|
|
8218
8440
|
}
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
this.
|
|
8222
|
-
return
|
|
8223
|
-
}
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8441
|
+
submit() {
|
|
8442
|
+
return (sanitizedEditForm) => {
|
|
8443
|
+
sanitizedEditForm.draft_id = this.eventTrigger.case_id;
|
|
8444
|
+
return this.casesService.createCase(this.caseType, sanitizedEditForm);
|
|
8445
|
+
};
|
|
8446
|
+
}
|
|
8447
|
+
validate() {
|
|
8448
|
+
return (sanitizedEditForm, pageId) => this.casesService
|
|
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);
|
|
8229
8663
|
};
|
|
8230
8664
|
if (!route.params['page']) {
|
|
8231
8665
|
this.goToFirst(wizard, canShowPredicate, route);
|
|
@@ -8462,7 +8896,7 @@ class EventCompletionStateMachineService {
|
|
|
8462
8896
|
entryActionForStateCompleteEventAndTask(state, context) {
|
|
8463
8897
|
// Trigger final state to complete processing of state machine
|
|
8464
8898
|
state.trigger(EventCompletionStates.Final);
|
|
8465
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8899
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8466
8900
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8467
8901
|
if (userTask?.task_data) {
|
|
8468
8902
|
context.sessionStorageService.setItem('assignNeeded', 'false');
|
|
@@ -8483,7 +8917,7 @@ class EventCompletionStateMachineService {
|
|
|
8483
8917
|
entryActionForStateTaskUnassigned(state, context) {
|
|
8484
8918
|
// Trigger final state to complete processing of state machine
|
|
8485
8919
|
state.trigger(EventCompletionStates.Final);
|
|
8486
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8920
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8487
8921
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8488
8922
|
if (userTask?.task_data) {
|
|
8489
8923
|
context.sessionStorageService.setItem('assignNeeded', 'true');
|
|
@@ -8521,7 +8955,7 @@ class EventCompletionStateMachineService {
|
|
|
8521
8955
|
this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
|
|
8522
8956
|
}
|
|
8523
8957
|
taskPresentInSessionStorage(context) {
|
|
8524
|
-
const clientContextStr = context.sessionStorageService.getItem(
|
|
8958
|
+
const clientContextStr = context.sessionStorageService.getItem('clientContext');
|
|
8525
8959
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
8526
8960
|
return !!userTask.task_data;
|
|
8527
8961
|
}
|
|
@@ -8884,11 +9318,8 @@ class CaseEditComponent {
|
|
|
8884
9318
|
workAllocationService;
|
|
8885
9319
|
alertService;
|
|
8886
9320
|
abstractConfig;
|
|
8887
|
-
cookieService;
|
|
8888
9321
|
static ORIGIN_QUERY_PARAM = 'origin';
|
|
8889
9322
|
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';
|
|
8892
9323
|
eventTrigger;
|
|
8893
9324
|
submit;
|
|
8894
9325
|
validate;
|
|
@@ -8912,7 +9343,7 @@ class CaseEditComponent {
|
|
|
8912
9343
|
error;
|
|
8913
9344
|
callbackErrorsSubject = new Subject();
|
|
8914
9345
|
validPageList = [];
|
|
8915
|
-
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig
|
|
9346
|
+
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig) {
|
|
8916
9347
|
this.fb = fb;
|
|
8917
9348
|
this.caseNotifier = caseNotifier;
|
|
8918
9349
|
this.router = router;
|
|
@@ -8930,7 +9361,6 @@ class CaseEditComponent {
|
|
|
8930
9361
|
this.workAllocationService = workAllocationService;
|
|
8931
9362
|
this.alertService = alertService;
|
|
8932
9363
|
this.abstractConfig = abstractConfig;
|
|
8933
|
-
this.cookieService = cookieService;
|
|
8934
9364
|
}
|
|
8935
9365
|
ngOnInit() {
|
|
8936
9366
|
this.wizard = this.wizardFactory.create(this.eventTrigger);
|
|
@@ -8948,7 +9378,6 @@ class CaseEditComponent {
|
|
|
8948
9378
|
this.route.queryParams.subscribe((params) => {
|
|
8949
9379
|
this.navigationOrigin = params[CaseEditComponent.ORIGIN_QUERY_PARAM];
|
|
8950
9380
|
});
|
|
8951
|
-
removeTaskFromClientContext(this.sessionStorageService);
|
|
8952
9381
|
}
|
|
8953
9382
|
ngOnDestroy() {
|
|
8954
9383
|
/* istanbul ignore else */
|
|
@@ -9038,12 +9467,12 @@ class CaseEditComponent {
|
|
|
9038
9467
|
this.isSubmitting = true;
|
|
9039
9468
|
// We have to run the event completion checks if task in session storage
|
|
9040
9469
|
// and if the task is in session storage, then is it associated to the case
|
|
9041
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
9470
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
9042
9471
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9043
9472
|
const taskInSessionStorage = userTask ? userTask.task_data : null;
|
|
9044
9473
|
let taskEventCompletionInfo;
|
|
9045
9474
|
let userInfo;
|
|
9046
|
-
const taskEventCompletionStr = this.sessionStorageService.getItem(
|
|
9475
|
+
const taskEventCompletionStr = this.sessionStorageService.getItem('taskEventCompletionInfo');
|
|
9047
9476
|
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
9048
9477
|
const assignNeeded = this.sessionStorageService.getItem('assignNeeded');
|
|
9049
9478
|
if (taskEventCompletionStr) {
|
|
@@ -9073,7 +9502,7 @@ class CaseEditComponent {
|
|
|
9073
9502
|
taskId: taskInSessionStorage.id,
|
|
9074
9503
|
createdTimestamp: Date.now()
|
|
9075
9504
|
};
|
|
9076
|
-
this.sessionStorageService.setItem(
|
|
9505
|
+
this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
|
|
9077
9506
|
this.isEventCompletionChecksRequired = true;
|
|
9078
9507
|
}
|
|
9079
9508
|
else {
|
|
@@ -9245,9 +9674,8 @@ class CaseEditComponent {
|
|
|
9245
9674
|
}), finalize(() => {
|
|
9246
9675
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9247
9676
|
// on event completion ensure the previous event clientContext/taskEventCompletionInfo removed
|
|
9248
|
-
|
|
9249
|
-
this.sessionStorageService.removeItem(
|
|
9250
|
-
this.sessionStorageService.removeItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO);
|
|
9677
|
+
this.sessionStorageService.removeItem('clientContext');
|
|
9678
|
+
this.sessionStorageService.removeItem('taskEventCompletionInfo');
|
|
9251
9679
|
this.isSubmitting = false;
|
|
9252
9680
|
}))
|
|
9253
9681
|
.subscribe(() => {
|
|
@@ -9275,7 +9703,7 @@ class CaseEditComponent {
|
|
|
9275
9703
|
});
|
|
9276
9704
|
}
|
|
9277
9705
|
postCompleteTaskIfRequired() {
|
|
9278
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
9706
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
9279
9707
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
9280
9708
|
const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
|
|
9281
9709
|
const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
|
|
@@ -9288,570 +9716,110 @@ class CaseEditComponent {
|
|
|
9288
9716
|
return this.workAllocationService.completeTask(task.id, this.eventTrigger.name);
|
|
9289
9717
|
}
|
|
9290
9718
|
return of(true);
|
|
9291
|
-
}
|
|
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}`;
|
|
9719
|
+
}
|
|
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);
|
|
9659
9726
|
}
|
|
9660
9727
|
else {
|
|
9661
|
-
|
|
9662
|
-
+ `/event-triggers/${eventTriggerId}`
|
|
9663
|
-
+ `?ignore-warning=${ignoreWarning}`;
|
|
9728
|
+
this.emitSubmitted(eventResponse);
|
|
9664
9729
|
}
|
|
9665
|
-
return url;
|
|
9666
9730
|
}
|
|
9667
|
-
|
|
9668
|
-
if (
|
|
9669
|
-
|
|
9731
|
+
buildConfirmation(response) {
|
|
9732
|
+
if (response['after_submit_callback_response']) {
|
|
9733
|
+
return new Confirmation(response['id'], response['callback_response_status'], response['after_submit_callback_response']['confirmation_header'], response['after_submit_callback_response']['confirmation_body']);
|
|
9670
9734
|
}
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
|
|
9674
|
-
});
|
|
9675
|
-
}
|
|
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);
|
|
9735
|
+
else {
|
|
9736
|
+
return null;
|
|
9686
9737
|
}
|
|
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
9738
|
}
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
let userInfo;
|
|
9701
|
-
if (userInfoStr) {
|
|
9702
|
-
userInfo = JSON.parse(userInfoStr);
|
|
9739
|
+
// checks whether current clientContext relevant for the event
|
|
9740
|
+
taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails) {
|
|
9741
|
+
if (!taskInSessionStorage || taskInSessionStorage.case_id !== eventDetails.caseId) {
|
|
9742
|
+
return false;
|
|
9703
9743
|
}
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
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);
|
|
9744
|
+
if (!taskEventCompletionInfo) {
|
|
9745
|
+
// if no task event present then there is no task to complete from previous event present
|
|
9746
|
+
return true;
|
|
9747
|
+
}
|
|
9748
|
+
else {
|
|
9749
|
+
if (taskEventCompletionInfo.taskId !== taskInSessionStorage.id) {
|
|
9750
|
+
return true;
|
|
9751
|
+
}
|
|
9752
|
+
else if ((taskEventCompletionInfo.taskId === taskInSessionStorage.id &&
|
|
9753
|
+
this.eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails))
|
|
9754
|
+
|| this.eventMoreThanDayAgo(taskEventCompletionInfo.createdTimestamp)) {
|
|
9755
|
+
// if the session storage not related to event, ignore it and remove
|
|
9756
|
+
this.sessionStorageService.removeItem('clientContext');
|
|
9757
|
+
this.sessionStorageService.removeItem('taskEventCompletionInfo');
|
|
9758
|
+
return false;
|
|
9759
|
+
}
|
|
9760
|
+
if (eventDetails.assignNeeded === 'false' && eventDetails.userId !== taskInSessionStorage.assignee) {
|
|
9761
|
+
// if the user does not match task assignee, assign is now needed
|
|
9762
|
+
// data cannot be deleted and ignored as it matches understanding
|
|
9763
|
+
this.sessionStorageService.setItem('assignNeeded', 'true');
|
|
9751
9764
|
}
|
|
9765
|
+
return true;
|
|
9752
9766
|
}
|
|
9753
|
-
return headers;
|
|
9754
9767
|
}
|
|
9755
|
-
|
|
9756
|
-
if (
|
|
9757
|
-
|
|
9758
|
-
const
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9768
|
+
onEventCanBeCompleted({ eventTrigger, eventCanBeCompleted, caseDetails, form, submit }) {
|
|
9769
|
+
if (eventCanBeCompleted) {
|
|
9770
|
+
// Submit
|
|
9771
|
+
const caseEventData = this.generateCaseEventData({ eventTrigger, form });
|
|
9772
|
+
this.caseSubmit({ form, caseEventData, submit });
|
|
9773
|
+
}
|
|
9774
|
+
else {
|
|
9775
|
+
// Navigate to tasks tab on case details page
|
|
9776
|
+
this.router.navigate([`/cases/case-details/${this.getCaseId(caseDetails)}/tasks`], { relativeTo: this.route });
|
|
9762
9777
|
}
|
|
9763
9778
|
}
|
|
9764
|
-
|
|
9765
|
-
|
|
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;
|
|
9797
|
-
}
|
|
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
|
-
});
|
|
9808
|
-
}
|
|
9809
|
-
submit() {
|
|
9810
|
-
return (sanitizedEditForm) => {
|
|
9811
|
-
sanitizedEditForm.draft_id = this.eventTrigger.case_id;
|
|
9812
|
-
return this.casesService.createCase(this.caseType, sanitizedEditForm);
|
|
9813
|
-
};
|
|
9779
|
+
getStatus(response) {
|
|
9780
|
+
return this.hasCallbackFailed(response) ? response['callback_response_status'] : response['delete_draft_response_status'];
|
|
9814
9781
|
}
|
|
9815
|
-
|
|
9816
|
-
return
|
|
9817
|
-
.validateCase(this.caseType, sanitizedEditForm, pageId);
|
|
9782
|
+
hasCallbackFailed(response) {
|
|
9783
|
+
return response['callback_response_status'] !== 'CALLBACK_COMPLETED';
|
|
9818
9784
|
}
|
|
9819
|
-
|
|
9820
|
-
if (
|
|
9821
|
-
return
|
|
9785
|
+
eventMoreThanDayAgo(timestamp) {
|
|
9786
|
+
if ((new Date().getTime() - timestamp) > (24 * 60 * 60 * 1000)) {
|
|
9787
|
+
return true;
|
|
9822
9788
|
}
|
|
9789
|
+
return false;
|
|
9823
9790
|
}
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
return this.eventTrigger ? true : false;
|
|
9791
|
+
eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails) {
|
|
9792
|
+
if (taskEventCompletionInfo.eventId !== eventDetails.eventId
|
|
9793
|
+
|| taskEventCompletionInfo.caseId !== eventDetails.caseId
|
|
9794
|
+
|| taskEventCompletionInfo.userId !== eventDetails.userId) {
|
|
9795
|
+
return true;
|
|
9796
|
+
}
|
|
9797
|
+
return false;
|
|
9832
9798
|
}
|
|
9833
|
-
static ɵfac = function
|
|
9834
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
9835
|
-
i0.ɵɵ
|
|
9836
|
-
}
|
|
9837
|
-
i0.ɵɵproperty("ngIf", ctx.isDataLoaded());
|
|
9838
|
-
} }, encapsulation: 2 });
|
|
9799
|
+
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)); };
|
|
9800
|
+
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) {
|
|
9801
|
+
i0.ɵɵelement(0, "router-outlet");
|
|
9802
|
+
} }, 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%}"] });
|
|
9839
9803
|
}
|
|
9840
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
9804
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
|
|
9841
9805
|
type: Component,
|
|
9842
|
-
args: [{ selector: 'ccd-case-
|
|
9843
|
-
}], () => [{ type:
|
|
9806
|
+
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"] }]
|
|
9807
|
+
}], () => [{ 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 }], { eventTrigger: [{
|
|
9844
9808
|
type: Input
|
|
9845
|
-
}],
|
|
9809
|
+
}], submit: [{
|
|
9846
9810
|
type: Input
|
|
9847
|
-
}],
|
|
9811
|
+
}], validate: [{
|
|
9812
|
+
type: Input
|
|
9813
|
+
}], saveDraft: [{
|
|
9814
|
+
type: Input
|
|
9815
|
+
}], caseDetails: [{
|
|
9848
9816
|
type: Input
|
|
9849
9817
|
}], cancelled: [{
|
|
9850
9818
|
type: Output
|
|
9851
9819
|
}], submitted: [{
|
|
9852
9820
|
type: Output
|
|
9853
9821
|
}] }); })();
|
|
9854
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(
|
|
9822
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 35 }); })();
|
|
9855
9823
|
|
|
9856
9824
|
function CaseEditConfirmComponent_div_3_Template(rf, ctx) { if (rf & 1) {
|
|
9857
9825
|
i0.ɵɵelement(0, "div");
|
|
@@ -11276,7 +11244,7 @@ class CaseEventCompletionTaskCancelledComponent {
|
|
|
11276
11244
|
}
|
|
11277
11245
|
onContinue() {
|
|
11278
11246
|
// Removes task to complete so event completes without task
|
|
11279
|
-
this.context.sessionStorageService.removeItem(
|
|
11247
|
+
this.context.sessionStorageService.removeItem('clientContext');
|
|
11280
11248
|
// may be able to remove this call below since it is now unneccesary
|
|
11281
11249
|
this.notifyEventCompletionCancelled.emit(true);
|
|
11282
11250
|
}
|
|
@@ -11462,7 +11430,7 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11462
11430
|
}
|
|
11463
11431
|
onContinue() {
|
|
11464
11432
|
// Get task details
|
|
11465
|
-
const clientContextStr = this.sessionStorageService.getItem(
|
|
11433
|
+
const clientContextStr = this.sessionStorageService.getItem('clientContext');
|
|
11466
11434
|
const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
|
|
11467
11435
|
const task = userTask ? userTask.task_data : null;
|
|
11468
11436
|
// not complete_task not utilised here as related to event completion
|
|
@@ -11492,7 +11460,7 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
11492
11460
|
}], notifyEventCompletionReassigned: [{
|
|
11493
11461
|
type: Output
|
|
11494
11462
|
}] }); })();
|
|
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:
|
|
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: 15 }); })();
|
|
11496
11464
|
|
|
11497
11465
|
class AddressOption {
|
|
11498
11466
|
description;
|
|
@@ -14240,7 +14208,7 @@ class FileUploadStateService {
|
|
|
14240
14208
|
const _c0$R = ["fileInput"];
|
|
14241
14209
|
const _c1$m = a0 => ({ "form-group-error bottom-30": a0 });
|
|
14242
14210
|
function WriteDocumentFieldComponent_span_6_Template(rf, ctx) { if (rf & 1) {
|
|
14243
|
-
i0.ɵɵelementStart(0, "span",
|
|
14211
|
+
i0.ɵɵelementStart(0, "span", 15);
|
|
14244
14212
|
i0.ɵɵtext(1);
|
|
14245
14213
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
14246
14214
|
i0.ɵɵelementEnd();
|
|
@@ -14250,7 +14218,7 @@ function WriteDocumentFieldComponent_span_6_Template(rf, ctx) { if (rf & 1) {
|
|
|
14250
14218
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r1.caseField.hint_text));
|
|
14251
14219
|
} }
|
|
14252
14220
|
function WriteDocumentFieldComponent_span_7_Template(rf, ctx) { if (rf & 1) {
|
|
14253
|
-
i0.ɵɵelementStart(0, "span",
|
|
14221
|
+
i0.ɵɵelementStart(0, "span", 16);
|
|
14254
14222
|
i0.ɵɵtext(1);
|
|
14255
14223
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
14256
14224
|
i0.ɵɵelementEnd();
|
|
@@ -14260,7 +14228,7 @@ function WriteDocumentFieldComponent_span_7_Template(rf, ctx) { if (rf & 1) {
|
|
|
14260
14228
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r1.fileUploadMessages));
|
|
14261
14229
|
} }
|
|
14262
14230
|
function WriteDocumentFieldComponent_ccd_read_document_field_9_Template(rf, ctx) { if (rf & 1) {
|
|
14263
|
-
i0.ɵɵelement(0, "ccd-read-document-field",
|
|
14231
|
+
i0.ɵɵelement(0, "ccd-read-document-field", 17);
|
|
14264
14232
|
} if (rf & 2) {
|
|
14265
14233
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
14266
14234
|
i0.ɵɵproperty("caseField", ctx_r1.caseField);
|
|
@@ -14293,6 +14261,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14293
14261
|
dialogSubscription;
|
|
14294
14262
|
caseNotifierSubscription;
|
|
14295
14263
|
jurisdictionSubs;
|
|
14264
|
+
fileName = 'No file chosen';
|
|
14296
14265
|
uploadedDocument;
|
|
14297
14266
|
dialogConfig;
|
|
14298
14267
|
secureModeOn;
|
|
@@ -14367,6 +14336,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14367
14336
|
}
|
|
14368
14337
|
else if (fileInput.target.files[0]) {
|
|
14369
14338
|
this.selectedFile = fileInput.target.files[0];
|
|
14339
|
+
this.fileName = fileInput.target.files[0].name;
|
|
14370
14340
|
this.displayFileUploadMessages(WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS);
|
|
14371
14341
|
const documentUpload = this.buildDocumentUploadData(this.selectedFile);
|
|
14372
14342
|
this.fileUploadStateService.setUploadInProgress(true);
|
|
@@ -14604,7 +14574,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14604
14574
|
} if (rf & 2) {
|
|
14605
14575
|
let _t;
|
|
14606
14576
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.fileInput = _t.first);
|
|
14607
|
-
} }, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
14577
|
+
} }, features: [i0.ɵɵInheritDefinitionFeature], decls: 26, vars: 27, consts: [["fileInput", ""], [1, "form-group", 3, "ngClass"], [3, "for"], [1, "form-label"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [3, "caseField", 4, "ngIf"], [2, "position", "relative"], [3, "click", "keyup", "id"], [1, "upload-file-container"], ["aria-label", "Choose file", 1, "button", "button-secondary", "input-label", 3, "for"], [1, "form-control", "bottom-30"], ["type", "file", 1, "input-upload-file", 3, "keydown.Tab", "change", "id", "accept"], [1, "form-group", "bottom-30"], ["type", "button", "aria-label", "Cancel upload", 1, "button", "button-secondary", 3, "click", "disabled"], [1, "form-hint"], [1, "error-message"], [3, "caseField"]], template: function WriteDocumentFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
14608
14578
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
14609
14579
|
i0.ɵɵelementStart(0, "div", 1)(1, "label", 2)(2, "span", 3);
|
|
14610
14580
|
i0.ɵɵpipe(3, "ccdFieldLabel");
|
|
@@ -14618,22 +14588,30 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14618
14588
|
i0.ɵɵelementStart(10, "div", 7)(11, "div", 8);
|
|
14619
14589
|
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()); });
|
|
14620
14590
|
i0.ɵɵelementEnd();
|
|
14621
|
-
i0.ɵɵelementStart(12, "
|
|
14622
|
-
i0.ɵɵ
|
|
14591
|
+
i0.ɵɵelementStart(12, "div", 9)(13, "label", 10);
|
|
14592
|
+
i0.ɵɵtext(14);
|
|
14593
|
+
i0.ɵɵpipe(15, "rpxTranslate");
|
|
14594
|
+
i0.ɵɵelementEnd();
|
|
14595
|
+
i0.ɵɵelementStart(16, "span", 11)(17, "span");
|
|
14596
|
+
i0.ɵɵtext(18);
|
|
14597
|
+
i0.ɵɵpipe(19, "rpxTranslate");
|
|
14623
14598
|
i0.ɵɵelementEnd()()();
|
|
14624
|
-
i0.ɵɵelementStart(
|
|
14625
|
-
i0.ɵɵlistener("
|
|
14626
|
-
i0.ɵɵ
|
|
14627
|
-
i0.ɵɵ
|
|
14599
|
+
i0.ɵɵelementStart(20, "input", 12, 0);
|
|
14600
|
+
i0.ɵɵlistener("keydown.Tab", function WriteDocumentFieldComponent_Template_input_keydown_Tab_20_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileValidationsOnTab()); })("change", function WriteDocumentFieldComponent_Template_input_change_20_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.fileChangeEvent($event, ctx.caseField.field_type.regular_expression)); });
|
|
14601
|
+
i0.ɵɵelementEnd()()();
|
|
14602
|
+
i0.ɵɵelementStart(22, "div", 13)(23, "button", 14);
|
|
14603
|
+
i0.ɵɵlistener("click", function WriteDocumentFieldComponent_Template_button_click_23_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.cancelUpload()); });
|
|
14604
|
+
i0.ɵɵtext(24);
|
|
14605
|
+
i0.ɵɵpipe(25, "rpxTranslate");
|
|
14628
14606
|
i0.ɵɵelementEnd()();
|
|
14629
14607
|
} if (rf & 2) {
|
|
14630
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
14608
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(25, _c1$m, !ctx.valid));
|
|
14631
14609
|
i0.ɵɵadvance();
|
|
14632
14610
|
i0.ɵɵproperty("for", ctx.id());
|
|
14633
14611
|
i0.ɵɵadvance();
|
|
14634
|
-
i0.ɵɵattribute("aria-label", i0.ɵɵpipeBind1(3,
|
|
14612
|
+
i0.ɵɵattribute("aria-label", i0.ɵɵpipeBind1(3, 15, ctx.caseField));
|
|
14635
14613
|
i0.ɵɵadvance(2);
|
|
14636
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5,
|
|
14614
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5, 17, ctx.caseField));
|
|
14637
14615
|
i0.ɵɵadvance(2);
|
|
14638
14616
|
i0.ɵɵproperty("ngIf", ctx.caseField.hint_text);
|
|
14639
14617
|
i0.ɵɵadvance();
|
|
@@ -14642,23 +14620,29 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
14642
14620
|
i0.ɵɵproperty("ngIf", ctx.caseField);
|
|
14643
14621
|
i0.ɵɵadvance(2);
|
|
14644
14622
|
i0.ɵɵproperty("id", ctx.createElementId("fileInputWrapper"));
|
|
14623
|
+
i0.ɵɵadvance(2);
|
|
14624
|
+
i0.ɵɵproperty("for", ctx.id());
|
|
14645
14625
|
i0.ɵɵadvance();
|
|
14626
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(15, 19, "Choose file"));
|
|
14627
|
+
i0.ɵɵadvance(4);
|
|
14628
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(19, 21, ctx.fileName));
|
|
14629
|
+
i0.ɵɵadvance(2);
|
|
14646
14630
|
i0.ɵɵpropertyInterpolate("accept", ctx.caseField.field_type.regular_expression);
|
|
14647
14631
|
i0.ɵɵproperty("id", ctx.id());
|
|
14648
14632
|
i0.ɵɵadvance(3);
|
|
14649
14633
|
i0.ɵɵproperty("disabled", !ctx.isUploadInProgress());
|
|
14650
14634
|
i0.ɵɵadvance();
|
|
14651
|
-
i0.ɵɵ
|
|
14652
|
-
} },
|
|
14635
|
+
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(25, 23, "Cancel upload"), " ");
|
|
14636
|
+
} }, styles: [".input-upload-file[_ngcontent-%COMP%]{width:100%;display:none}.upload-file-container[_ngcontent-%COMP%]{display:flex;align-items:baseline}.input-label[_ngcontent-%COMP%]{width:8rem}.form [_nghost-%COMP%] .grey-bar>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form [_nghost-%COMP%] .grey-bar>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form [_nghost-%COMP%] .grey-bar>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}"] });
|
|
14653
14637
|
}
|
|
14654
14638
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteDocumentFieldComponent, [{
|
|
14655
14639
|
type: Component,
|
|
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
|
|
14640
|
+
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}}\"\n >{{(caseField | ccdFieldLabel)}}</span\n >\n </label>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\"\n >{{caseField.hint_text | rpxTranslate}}</span\n >\n <span class=\"error-message\" *ngIf=\"fileUploadMessages && !valid\"\n >{{fileUploadMessages | rpxTranslate}}</span\n >\n\n <div>\n <!--<span *ngIf=\"getUploadedFileName()\" class=\"text-16\">File name: {{getUploadedFileName()}}</span>-->\n <ccd-read-document-field\n *ngIf=\"caseField\"\n [caseField]=\"caseField\"\n ></ccd-read-document-field>\n </div>\n\n <div style=\"position: relative\">\n <div\n [id]=\"createElementId('fileInputWrapper')\"\n (click)=\"fileSelectEvent()\"\n (keyup)=\"fileSelectEvent()\"\n ></div>\n <div class=\"upload-file-container\">\n <label\n [for]=\"id()\"\n class=\"button button-secondary input-label\"\n aria-label=\"Choose file\"\n >{{'Choose file' | rpxTranslate}}</label\n >\n <span class=\"form-control bottom-30\">\n <span>{{fileName | rpxTranslate}}</span>\n </span>\n </div>\n <input\n [id]=\"id()\"\n type=\"file\"\n class=\"input-upload-file\"\n (keydown.Tab)=\"fileValidationsOnTab()\"\n (change)=\"fileChangeEvent($event, caseField.field_type.regular_expression)\"\n accept=\"{{caseField.field_type.regular_expression}}\"\n #fileInput\n />\n </div>\n</div>\n<div class=\"form-group bottom-30\">\n <button\n class=\"button button-secondary\"\n type=\"button\"\n aria-label=\"Cancel upload\"\n (click)=\"cancelUpload()\"\n [disabled]=\"!isUploadInProgress()\"\n >\n {{'Cancel upload' | rpxTranslate}}\n </button>\n</div>\n", styles: [".input-upload-file{width:100%;display:none}.upload-file-container{display:flex;align-items:baseline}.input-label{width:8rem}.form :host::ng-deep .grey-bar>*>.form-group,.form :host::ng-deep .grey-bar>*>*>.form-group,.form :host::ng-deep .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form :host::ng-deep .grey-bar>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form :host::ng-deep .grey-bar>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field input:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field select:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}\n"] }]
|
|
14657
14641
|
}], () => [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatLegacyDialog }, { type: FileUploadStateService }, { type: JurisdictionService }], { fileInput: [{
|
|
14658
14642
|
type: ViewChild,
|
|
14659
14643
|
args: ['fileInput', { static: false }]
|
|
14660
14644
|
}] }); })();
|
|
14661
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteDocumentFieldComponent, { className: "WriteDocumentFieldComponent", filePath: "lib/shared/components/palette/document/write-document-field.component.ts", lineNumber:
|
|
14645
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteDocumentFieldComponent, { className: "WriteDocumentFieldComponent", filePath: "lib/shared/components/palette/document/write-document-field.component.ts", lineNumber: 24 }); })();
|
|
14662
14646
|
|
|
14663
14647
|
class DynamicListPipe {
|
|
14664
14648
|
static EMPTY = '';
|
|
@@ -22533,11 +22517,11 @@ class FieldWriteComponent extends AbstractFieldWriteComponent {
|
|
|
22533
22517
|
} if (rf & 2) {
|
|
22534
22518
|
i0.ɵɵclassProp("grey-bar", ctx.canHaveGreyBar && !ctx.caseField.hiddenCannotChange);
|
|
22535
22519
|
i0.ɵɵproperty("hidden", ctx.caseField.hidden);
|
|
22536
|
-
} }, styles: [".form [_nghost-%COMP%] .grey-bar>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form [_nghost-%COMP%] .grey-bar>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form [_nghost-%COMP%] .grey-bar>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}"] });
|
|
22520
|
+
} }, styles: [".input-upload-file[_ngcontent-%COMP%]{width:100%;display:none}.upload-file-container[_ngcontent-%COMP%]{display:flex;align-items:baseline}.input-label[_ngcontent-%COMP%]{width:8rem}.form [_nghost-%COMP%] .grey-bar>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>*>.form-group, .form [_nghost-%COMP%] .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form [_nghost-%COMP%] .grey-bar>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group:not(.form-group-error), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form [_nghost-%COMP%] .grey-bar>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>*>.form-group textarea:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field input:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field select:not(.inline-block), .form [_nghost-%COMP%] .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}"] });
|
|
22537
22521
|
}
|
|
22538
22522
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FieldWriteComponent, [{
|
|
22539
22523
|
type: Component,
|
|
22540
|
-
args: [{ selector: 'ccd-field-write', template: "<div [hidden]=\"caseField.hidden\" [class.grey-bar]=\"canHaveGreyBar && !caseField.hiddenCannotChange\">\n <ng-container #fieldContainer></ng-container>\n</div>\n", styles: [".form :host::ng-deep .grey-bar>*>.form-group,.form :host::ng-deep .grey-bar>*>*>.form-group,.form :host::ng-deep .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form :host::ng-deep .grey-bar>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form :host::ng-deep .grey-bar>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field input:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field select:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}\n"] }]
|
|
22524
|
+
args: [{ selector: 'ccd-field-write', template: "<div [hidden]=\"caseField.hidden\" [class.grey-bar]=\"canHaveGreyBar && !caseField.hiddenCannotChange\">\n <ng-container #fieldContainer></ng-container>\n</div>\n", styles: [".input-upload-file{width:100%;display:none}.upload-file-container{display:flex;align-items:baseline}.input-label{width:8rem}.form :host::ng-deep .grey-bar>*>.form-group,.form :host::ng-deep .grey-bar>*>*>.form-group,.form :host::ng-deep .grey-bar>*>dl.case-field{margin-left:15px;padding-left:15px}.form :host::ng-deep .grey-bar>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>*>.form-group:not(.form-group-error),.form :host::ng-deep .grey-bar>*>dl.case-field:not(.form-group-error){border-left:solid 5px #b1b4b6}.form :host::ng-deep .grey-bar>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group input:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group select:not(.inline-block),.form :host::ng-deep .grey-bar>*>*>.form-group textarea:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field input:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field select:not(.inline-block),.form :host::ng-deep .grey-bar>*>dl.case-field textarea:not(.inline-block){display:block}\n"] }]
|
|
22541
22525
|
}], () => [{ type: i0.ComponentFactoryResolver }, { type: PaletteService }], { caseFields: [{
|
|
22542
22526
|
type: Input
|
|
22543
22527
|
}], fieldContainer: [{
|
|
@@ -34334,6 +34318,7 @@ class EventStartGuard {
|
|
|
34334
34318
|
sessionStorageService;
|
|
34335
34319
|
abstractConfig;
|
|
34336
34320
|
cookieService;
|
|
34321
|
+
static CLIENT_CONTEXT = 'clientContext';
|
|
34337
34322
|
constructor(workAllocationService, router, sessionStorageService, abstractConfig, cookieService) {
|
|
34338
34323
|
this.workAllocationService = workAllocationService;
|
|
34339
34324
|
this.router = router;
|
|
@@ -34354,7 +34339,7 @@ class EventStartGuard {
|
|
|
34354
34339
|
const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
|
|
34355
34340
|
const languageCookie = this.cookieService.getCookie('exui-preferred-language');
|
|
34356
34341
|
const currentLanguage = !!languageCookie && languageCookie !== '' ? languageCookie : 'en';
|
|
34357
|
-
const preClientContext = this.sessionStorageService.getItem(
|
|
34342
|
+
const preClientContext = this.sessionStorageService.getItem(EventStartGuard.CLIENT_CONTEXT);
|
|
34358
34343
|
if (!preClientContext) {
|
|
34359
34344
|
// creates client context for language if not already existing
|
|
34360
34345
|
const storeClientContext = {
|
|
@@ -34364,7 +34349,7 @@ class EventStartGuard {
|
|
|
34364
34349
|
}
|
|
34365
34350
|
}
|
|
34366
34351
|
};
|
|
34367
|
-
this.sessionStorageService.setItem(
|
|
34352
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34368
34353
|
}
|
|
34369
34354
|
else {
|
|
34370
34355
|
const clientContextObj = JSON.parse(preClientContext);
|
|
@@ -34378,7 +34363,7 @@ class EventStartGuard {
|
|
|
34378
34363
|
}
|
|
34379
34364
|
}
|
|
34380
34365
|
};
|
|
34381
|
-
this.sessionStorageService.setItem(
|
|
34366
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(clientContextAddLanguage));
|
|
34382
34367
|
}
|
|
34383
34368
|
}
|
|
34384
34369
|
if (caseInfoStr) {
|
|
@@ -34439,10 +34424,13 @@ class EventStartGuard {
|
|
|
34439
34424
|
}
|
|
34440
34425
|
}
|
|
34441
34426
|
};
|
|
34442
|
-
this.sessionStorageService.setItem(
|
|
34427
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34443
34428
|
return true;
|
|
34444
34429
|
}
|
|
34445
34430
|
}
|
|
34431
|
+
removeTaskFromSessionStorage() {
|
|
34432
|
+
this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
|
|
34433
|
+
}
|
|
34446
34434
|
checkForTasks(payload, caseId, eventId, taskId, userId) {
|
|
34447
34435
|
if (taskId && payload?.tasks?.length > 0) {
|
|
34448
34436
|
const task = payload.tasks.find((t) => t.id == taskId);
|
|
@@ -34467,11 +34455,11 @@ class EventStartGuard {
|
|
|
34467
34455
|
}
|
|
34468
34456
|
}
|
|
34469
34457
|
};
|
|
34470
|
-
this.sessionStorageService.setItem(
|
|
34471
|
-
this.sessionStorageService.setItem(
|
|
34458
|
+
this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
|
|
34459
|
+
this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
|
|
34472
34460
|
}
|
|
34473
34461
|
else {
|
|
34474
|
-
|
|
34462
|
+
this.removeTaskFromSessionStorage();
|
|
34475
34463
|
}
|
|
34476
34464
|
}
|
|
34477
34465
|
if (payload.task_required_for_event) {
|
|
@@ -34650,6 +34638,7 @@ class EventStartStateMachineService {
|
|
|
34650
34638
|
}
|
|
34651
34639
|
}
|
|
34652
34640
|
};
|
|
34641
|
+
context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
|
|
34653
34642
|
let userInfo;
|
|
34654
34643
|
const userInfoStr = context.sessionStorageService.getItem('userDetails');
|
|
34655
34644
|
if (userInfoStr) {
|
|
@@ -34663,9 +34652,7 @@ class EventStartStateMachineService {
|
|
|
34663
34652
|
taskId: task.id,
|
|
34664
34653
|
createdTimestamp: Date.now()
|
|
34665
34654
|
};
|
|
34666
|
-
context.sessionStorageService.setItem(
|
|
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));
|
|
34655
|
+
context.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
|
|
34669
34656
|
// Allow user to perform the event
|
|
34670
34657
|
context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
|
|
34671
34658
|
}
|