@hmcts/ccd-case-ui-toolkit 6.14.4-eui-4157 → 6.14.4-hotfix-110
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/bundles/hmcts-ccd-case-ui-toolkit.umd.js +245 -235
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/services/cases.service.js +7 -4
- package/esm2015/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.js +33 -24
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +237 -227
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts +3 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +6 -2
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -7210,13 +7210,215 @@ WizardPageFieldToCaseFieldMapper.ɵprov = i0.ɵɵdefineInjectable({ token: Wizar
|
|
|
7210
7210
|
}]
|
|
7211
7211
|
}], null, null); })();
|
|
7212
7212
|
|
|
7213
|
+
const MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
7214
|
+
class WorkAllocationService {
|
|
7215
|
+
constructor(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
7216
|
+
this.http = http;
|
|
7217
|
+
this.appConfig = appConfig;
|
|
7218
|
+
this.errorService = errorService;
|
|
7219
|
+
this.alertService = alertService;
|
|
7220
|
+
this.sessionStorageService = sessionStorageService;
|
|
7221
|
+
// Check to see if work allocation is enabled
|
|
7222
|
+
}
|
|
7223
|
+
/**
|
|
7224
|
+
* Call the API to get tasks matching the search criteria.
|
|
7225
|
+
* @param searchRequest The search parameters that specify which tasks to match.
|
|
7226
|
+
*/
|
|
7227
|
+
searchTasks(searchRequest) {
|
|
7228
|
+
// Do not need to check if WA enabled as parent method will do that
|
|
7229
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/searchForCompletable`;
|
|
7230
|
+
return this.http
|
|
7231
|
+
.post(url, { searchRequest }, null, false)
|
|
7232
|
+
.pipe(map(response => response), catchError(error => {
|
|
7233
|
+
this.errorService.setError(error);
|
|
7234
|
+
// explicitly eat away 401 error and 400 error
|
|
7235
|
+
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
7236
|
+
// do nothing
|
|
7237
|
+
console.log('error status 401 or 400', error);
|
|
7238
|
+
}
|
|
7239
|
+
else {
|
|
7240
|
+
return throwError(error);
|
|
7241
|
+
}
|
|
7242
|
+
}));
|
|
7243
|
+
}
|
|
7244
|
+
isWAEnabled(jurisdiction, caseType) {
|
|
7245
|
+
this.features = this.appConfig.getWAServiceConfig();
|
|
7246
|
+
let enabled = false;
|
|
7247
|
+
if (!jurisdiction || !caseType) {
|
|
7248
|
+
const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
7249
|
+
jurisdiction = caseInfo.jurisdiction;
|
|
7250
|
+
caseType = caseInfo.caseType;
|
|
7251
|
+
}
|
|
7252
|
+
if (!this.features || !this.features.configurations) {
|
|
7253
|
+
return false;
|
|
7254
|
+
}
|
|
7255
|
+
this.features.configurations.forEach(serviceConfig => {
|
|
7256
|
+
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
7257
|
+
enabled = true;
|
|
7258
|
+
}
|
|
7259
|
+
});
|
|
7260
|
+
return enabled;
|
|
7261
|
+
}
|
|
7262
|
+
/**
|
|
7263
|
+
* Call the API to assign a task.
|
|
7264
|
+
* @param taskId specifies which task should be assigned.
|
|
7265
|
+
* @param userId specifies the user the task should be assigned to.
|
|
7266
|
+
*/
|
|
7267
|
+
assignTask(taskId, userId) {
|
|
7268
|
+
if (!this.isWAEnabled()) {
|
|
7269
|
+
return of(null);
|
|
7270
|
+
}
|
|
7271
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/assign`;
|
|
7272
|
+
return this.http
|
|
7273
|
+
.post(url, { userId })
|
|
7274
|
+
.pipe(catchError(error => {
|
|
7275
|
+
this.errorService.setError(error);
|
|
7276
|
+
return throwError(error);
|
|
7277
|
+
}));
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* Call the API to complete a task.
|
|
7281
|
+
* @param taskId specifies which task should be completed.
|
|
7282
|
+
*/
|
|
7283
|
+
completeTask(taskId) {
|
|
7284
|
+
if (!this.isWAEnabled()) {
|
|
7285
|
+
return of(null);
|
|
7286
|
+
}
|
|
7287
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
7288
|
+
return this.http
|
|
7289
|
+
.post(url, {})
|
|
7290
|
+
.pipe(catchError(error => {
|
|
7291
|
+
this.errorService.setError(error);
|
|
7292
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
7293
|
+
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
7294
|
+
this.handleTaskCompletionError(response);
|
|
7295
|
+
});
|
|
7296
|
+
return throwError(error);
|
|
7297
|
+
}));
|
|
7298
|
+
}
|
|
7299
|
+
/**
|
|
7300
|
+
* Call the API to assign and complete a task.
|
|
7301
|
+
* @param taskId specifies which task should be completed.
|
|
7302
|
+
*/
|
|
7303
|
+
assignAndCompleteTask(taskId) {
|
|
7304
|
+
if (!this.isWAEnabled()) {
|
|
7305
|
+
return of(null);
|
|
7306
|
+
}
|
|
7307
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
7308
|
+
return this.http
|
|
7309
|
+
.post(url, {
|
|
7310
|
+
completion_options: {
|
|
7311
|
+
assign_and_complete: true
|
|
7312
|
+
}
|
|
7313
|
+
})
|
|
7314
|
+
.pipe(catchError(error => {
|
|
7315
|
+
this.errorService.setError(error);
|
|
7316
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
7317
|
+
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
7318
|
+
this.handleTaskCompletionError(response);
|
|
7319
|
+
});
|
|
7320
|
+
return throwError(error);
|
|
7321
|
+
}));
|
|
7322
|
+
}
|
|
7323
|
+
/**
|
|
7324
|
+
* Handles the response from the observable to get the user details when task is completed.
|
|
7325
|
+
* @param response is the response given from the observable which contains the user detaild.
|
|
7326
|
+
*/
|
|
7327
|
+
handleTaskCompletionError(response) {
|
|
7328
|
+
const userDetails = response;
|
|
7329
|
+
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
7330
|
+
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
7331
|
+
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
7332
|
+
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
7333
|
+
}
|
|
7334
|
+
}
|
|
7335
|
+
/**
|
|
7336
|
+
* Returns true if the user's role is equivalent to a caseworker.
|
|
7337
|
+
* @param roles is the list of roles found from the current user.
|
|
7338
|
+
*/
|
|
7339
|
+
userIsCaseworker(roles) {
|
|
7340
|
+
const lowerCaseRoles = roles.map(role => role.toLowerCase());
|
|
7341
|
+
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
7342
|
+
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
7343
|
+
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
7344
|
+
}
|
|
7345
|
+
/**
|
|
7346
|
+
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
7347
|
+
* 1. No tasks found => Success.
|
|
7348
|
+
* 2. One task found => Mark as done => Success.
|
|
7349
|
+
* 3. One task found => Mark as done throws error => Failure.
|
|
7350
|
+
* 4. More than one task found => Failure.
|
|
7351
|
+
* 5. Search call throws an error => Failure.
|
|
7352
|
+
* @param ccdId The ID of the case to find tasks for.
|
|
7353
|
+
* @param eventId The ID of the event to find tasks for.
|
|
7354
|
+
*/
|
|
7355
|
+
completeAppropriateTask(ccdId, eventId, jurisdiction, caseTypeId) {
|
|
7356
|
+
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
7357
|
+
return of(null);
|
|
7358
|
+
}
|
|
7359
|
+
const taskSearchParameter = {
|
|
7360
|
+
ccdId,
|
|
7361
|
+
eventId,
|
|
7362
|
+
jurisdiction,
|
|
7363
|
+
caseTypeId
|
|
7364
|
+
};
|
|
7365
|
+
return this.searchTasks(taskSearchParameter)
|
|
7366
|
+
.pipe(map((response) => {
|
|
7367
|
+
const tasks = response.tasks;
|
|
7368
|
+
if (tasks && tasks.length > 0) {
|
|
7369
|
+
if (tasks.length === 1) {
|
|
7370
|
+
this.completeTask(tasks[0].id).subscribe();
|
|
7371
|
+
}
|
|
7372
|
+
else {
|
|
7373
|
+
// This is a problem. Throw an appropriate error.
|
|
7374
|
+
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
7377
|
+
return true; // All good. Nothing to see here.
|
|
7378
|
+
}), catchError(error => {
|
|
7379
|
+
// Simply rethrow it.
|
|
7380
|
+
return throwError(error);
|
|
7381
|
+
}));
|
|
7382
|
+
}
|
|
7383
|
+
/**
|
|
7384
|
+
* Return tasks for case and event.
|
|
7385
|
+
*/
|
|
7386
|
+
getTasksByCaseIdAndEventId(eventId, caseId, caseType, jurisdiction) {
|
|
7387
|
+
const defaultPayload = {
|
|
7388
|
+
task_required_for_event: false,
|
|
7389
|
+
tasks: []
|
|
7390
|
+
};
|
|
7391
|
+
if (!this.isWAEnabled()) {
|
|
7392
|
+
return of(defaultPayload);
|
|
7393
|
+
}
|
|
7394
|
+
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/case/tasks/${caseId}/event/${eventId}/caseType/${caseType}/jurisdiction/${jurisdiction}`);
|
|
7395
|
+
}
|
|
7396
|
+
/**
|
|
7397
|
+
* Call the API to get a task
|
|
7398
|
+
*/
|
|
7399
|
+
getTask(taskId) {
|
|
7400
|
+
if (!this.isWAEnabled()) {
|
|
7401
|
+
return of({ task: null });
|
|
7402
|
+
}
|
|
7403
|
+
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}`);
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
7407
|
+
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
7408
|
+
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(AlertService), i0.ɵɵinject(SessionStorageService)); };
|
|
7409
|
+
WorkAllocationService.ɵprov = i0.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
7410
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkAllocationService, [{
|
|
7411
|
+
type: Injectable
|
|
7412
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null); })();
|
|
7413
|
+
|
|
7213
7414
|
class CasesService {
|
|
7214
|
-
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService) {
|
|
7415
|
+
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, workAllocationService, loadingService, sessionStorageService) {
|
|
7215
7416
|
this.http = http;
|
|
7216
7417
|
this.appConfig = appConfig;
|
|
7217
7418
|
this.orderService = orderService;
|
|
7218
7419
|
this.errorService = errorService;
|
|
7219
7420
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
7421
|
+
this.workAllocationService = workAllocationService;
|
|
7220
7422
|
this.loadingService = loadingService;
|
|
7221
7423
|
this.sessionStorageService = sessionStorageService;
|
|
7222
7424
|
this.get = this.getCaseView;
|
|
@@ -7442,11 +7644,11 @@ CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE = 'application/vnd.uk.gov.hmcts.ccd
|
|
|
7442
7644
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
7443
7645
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
7444
7646
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
7445
|
-
CasesService.ɵ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)); };
|
|
7647
|
+
CasesService.ɵ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(WorkAllocationService), i0.ɵɵinject(LoadingService), i0.ɵɵinject(SessionStorageService)); };
|
|
7446
7648
|
CasesService.ɵprov = i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
7447
7649
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasesService, [{
|
|
7448
7650
|
type: Injectable
|
|
7449
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }]; }, null); })();
|
|
7651
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: WorkAllocationService }, { type: LoadingService }, { type: SessionStorageService }]; }, null); })();
|
|
7450
7652
|
|
|
7451
7653
|
class EventTriggerService {
|
|
7452
7654
|
constructor() {
|
|
@@ -8049,207 +8251,6 @@ PageValidationService.ɵprov = i0.ɵɵdefineInjectable({ token: PageValidationSe
|
|
|
8049
8251
|
type: Injectable
|
|
8050
8252
|
}], function () { return [{ type: CaseFieldService }]; }, null); })();
|
|
8051
8253
|
|
|
8052
|
-
const MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
8053
|
-
class WorkAllocationService {
|
|
8054
|
-
constructor(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
8055
|
-
this.http = http;
|
|
8056
|
-
this.appConfig = appConfig;
|
|
8057
|
-
this.errorService = errorService;
|
|
8058
|
-
this.alertService = alertService;
|
|
8059
|
-
this.sessionStorageService = sessionStorageService;
|
|
8060
|
-
// Check to see if work allocation is enabled
|
|
8061
|
-
}
|
|
8062
|
-
/**
|
|
8063
|
-
* Call the API to get tasks matching the search criteria.
|
|
8064
|
-
* @param searchRequest The search parameters that specify which tasks to match.
|
|
8065
|
-
*/
|
|
8066
|
-
searchTasks(searchRequest) {
|
|
8067
|
-
// Do not need to check if WA enabled as parent method will do that
|
|
8068
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/searchForCompletable`;
|
|
8069
|
-
return this.http
|
|
8070
|
-
.post(url, { searchRequest }, null, false)
|
|
8071
|
-
.pipe(map(response => response), catchError(error => {
|
|
8072
|
-
this.errorService.setError(error);
|
|
8073
|
-
// explicitly eat away 401 error and 400 error
|
|
8074
|
-
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
8075
|
-
// do nothing
|
|
8076
|
-
console.log('error status 401 or 400', error);
|
|
8077
|
-
}
|
|
8078
|
-
else {
|
|
8079
|
-
return throwError(error);
|
|
8080
|
-
}
|
|
8081
|
-
}));
|
|
8082
|
-
}
|
|
8083
|
-
isWAEnabled(jurisdiction, caseType) {
|
|
8084
|
-
this.features = this.appConfig.getWAServiceConfig();
|
|
8085
|
-
let enabled = false;
|
|
8086
|
-
if (!jurisdiction || !caseType) {
|
|
8087
|
-
const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
8088
|
-
jurisdiction = caseInfo.jurisdiction;
|
|
8089
|
-
caseType = caseInfo.caseType;
|
|
8090
|
-
}
|
|
8091
|
-
if (!this.features || !this.features.configurations) {
|
|
8092
|
-
return false;
|
|
8093
|
-
}
|
|
8094
|
-
this.features.configurations.forEach(serviceConfig => {
|
|
8095
|
-
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
8096
|
-
enabled = true;
|
|
8097
|
-
}
|
|
8098
|
-
});
|
|
8099
|
-
return enabled;
|
|
8100
|
-
}
|
|
8101
|
-
/**
|
|
8102
|
-
* Call the API to assign a task.
|
|
8103
|
-
* @param taskId specifies which task should be assigned.
|
|
8104
|
-
* @param userId specifies the user the task should be assigned to.
|
|
8105
|
-
*/
|
|
8106
|
-
assignTask(taskId, userId) {
|
|
8107
|
-
if (!this.isWAEnabled()) {
|
|
8108
|
-
return of(null);
|
|
8109
|
-
}
|
|
8110
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/assign`;
|
|
8111
|
-
return this.http
|
|
8112
|
-
.post(url, { userId })
|
|
8113
|
-
.pipe(catchError(error => {
|
|
8114
|
-
this.errorService.setError(error);
|
|
8115
|
-
return throwError(error);
|
|
8116
|
-
}));
|
|
8117
|
-
}
|
|
8118
|
-
/**
|
|
8119
|
-
* Call the API to complete a task.
|
|
8120
|
-
* @param taskId specifies which task should be completed.
|
|
8121
|
-
*/
|
|
8122
|
-
completeTask(taskId) {
|
|
8123
|
-
if (!this.isWAEnabled()) {
|
|
8124
|
-
return of(null);
|
|
8125
|
-
}
|
|
8126
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
8127
|
-
return this.http
|
|
8128
|
-
.post(url, {})
|
|
8129
|
-
.pipe(catchError(error => {
|
|
8130
|
-
this.errorService.setError(error);
|
|
8131
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
8132
|
-
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
8133
|
-
this.handleTaskCompletionError(response);
|
|
8134
|
-
});
|
|
8135
|
-
return throwError(error);
|
|
8136
|
-
}));
|
|
8137
|
-
}
|
|
8138
|
-
/**
|
|
8139
|
-
* Call the API to assign and complete a task.
|
|
8140
|
-
* @param taskId specifies which task should be completed.
|
|
8141
|
-
*/
|
|
8142
|
-
assignAndCompleteTask(taskId) {
|
|
8143
|
-
if (!this.isWAEnabled()) {
|
|
8144
|
-
return of(null);
|
|
8145
|
-
}
|
|
8146
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
8147
|
-
return this.http
|
|
8148
|
-
.post(url, {
|
|
8149
|
-
completion_options: {
|
|
8150
|
-
assign_and_complete: true
|
|
8151
|
-
}
|
|
8152
|
-
})
|
|
8153
|
-
.pipe(catchError(error => {
|
|
8154
|
-
this.errorService.setError(error);
|
|
8155
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
8156
|
-
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
8157
|
-
this.handleTaskCompletionError(response);
|
|
8158
|
-
});
|
|
8159
|
-
return throwError(error);
|
|
8160
|
-
}));
|
|
8161
|
-
}
|
|
8162
|
-
/**
|
|
8163
|
-
* Handles the response from the observable to get the user details when task is completed.
|
|
8164
|
-
* @param response is the response given from the observable which contains the user detaild.
|
|
8165
|
-
*/
|
|
8166
|
-
handleTaskCompletionError(response) {
|
|
8167
|
-
const userDetails = response;
|
|
8168
|
-
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
8169
|
-
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
8170
|
-
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
8171
|
-
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
8172
|
-
}
|
|
8173
|
-
}
|
|
8174
|
-
/**
|
|
8175
|
-
* Returns true if the user's role is equivalent to a caseworker.
|
|
8176
|
-
* @param roles is the list of roles found from the current user.
|
|
8177
|
-
*/
|
|
8178
|
-
userIsCaseworker(roles) {
|
|
8179
|
-
const lowerCaseRoles = roles.map(role => role.toLowerCase());
|
|
8180
|
-
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
8181
|
-
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
8182
|
-
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
8183
|
-
}
|
|
8184
|
-
/**
|
|
8185
|
-
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
8186
|
-
* 1. No tasks found => Success.
|
|
8187
|
-
* 2. One task found => Mark as done => Success.
|
|
8188
|
-
* 3. One task found => Mark as done throws error => Failure.
|
|
8189
|
-
* 4. More than one task found => Failure.
|
|
8190
|
-
* 5. Search call throws an error => Failure.
|
|
8191
|
-
* @param ccdId The ID of the case to find tasks for.
|
|
8192
|
-
* @param eventId The ID of the event to find tasks for.
|
|
8193
|
-
*/
|
|
8194
|
-
completeAppropriateTask(ccdId, eventId, jurisdiction, caseTypeId) {
|
|
8195
|
-
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
8196
|
-
return of(null);
|
|
8197
|
-
}
|
|
8198
|
-
const taskSearchParameter = {
|
|
8199
|
-
ccdId,
|
|
8200
|
-
eventId,
|
|
8201
|
-
jurisdiction,
|
|
8202
|
-
caseTypeId
|
|
8203
|
-
};
|
|
8204
|
-
return this.searchTasks(taskSearchParameter)
|
|
8205
|
-
.pipe(map((response) => {
|
|
8206
|
-
const tasks = response.tasks;
|
|
8207
|
-
if (tasks && tasks.length > 0) {
|
|
8208
|
-
if (tasks.length === 1) {
|
|
8209
|
-
this.completeTask(tasks[0].id).subscribe();
|
|
8210
|
-
}
|
|
8211
|
-
else {
|
|
8212
|
-
// This is a problem. Throw an appropriate error.
|
|
8213
|
-
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
8214
|
-
}
|
|
8215
|
-
}
|
|
8216
|
-
return true; // All good. Nothing to see here.
|
|
8217
|
-
}), catchError(error => {
|
|
8218
|
-
// Simply rethrow it.
|
|
8219
|
-
return throwError(error);
|
|
8220
|
-
}));
|
|
8221
|
-
}
|
|
8222
|
-
/**
|
|
8223
|
-
* Return tasks for case and event.
|
|
8224
|
-
*/
|
|
8225
|
-
getTasksByCaseIdAndEventId(eventId, caseId, caseType, jurisdiction) {
|
|
8226
|
-
const defaultPayload = {
|
|
8227
|
-
task_required_for_event: false,
|
|
8228
|
-
tasks: []
|
|
8229
|
-
};
|
|
8230
|
-
if (!this.isWAEnabled()) {
|
|
8231
|
-
return of(defaultPayload);
|
|
8232
|
-
}
|
|
8233
|
-
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/case/tasks/${caseId}/event/${eventId}/caseType/${caseType}/jurisdiction/${jurisdiction}`);
|
|
8234
|
-
}
|
|
8235
|
-
/**
|
|
8236
|
-
* Call the API to get a task
|
|
8237
|
-
*/
|
|
8238
|
-
getTask(taskId) {
|
|
8239
|
-
if (!this.isWAEnabled()) {
|
|
8240
|
-
return of({ task: null });
|
|
8241
|
-
}
|
|
8242
|
-
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}`);
|
|
8243
|
-
}
|
|
8244
|
-
}
|
|
8245
|
-
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
8246
|
-
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
8247
|
-
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(AlertService), i0.ɵɵinject(SessionStorageService)); };
|
|
8248
|
-
WorkAllocationService.ɵprov = i0.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
8249
|
-
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkAllocationService, [{
|
|
8250
|
-
type: Injectable
|
|
8251
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null); })();
|
|
8252
|
-
|
|
8253
8254
|
class CaseEditComponent {
|
|
8254
8255
|
constructor(fb, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService) {
|
|
8255
8256
|
this.fb = fb;
|
|
@@ -26775,7 +26776,7 @@ function CaseFullAccessViewComponent_ng_container_12_Template(rf, ctx) { if (rf
|
|
|
26775
26776
|
const _r34 = i0.ɵɵgetCurrentView();
|
|
26776
26777
|
i0.ɵɵelementContainerStart(0);
|
|
26777
26778
|
i0.ɵɵelementStart(1, "mat-tab-group", 23, 24);
|
|
26778
|
-
i0.ɵɵlistener("
|
|
26779
|
+
i0.ɵɵlistener("selectedIndexChange", function CaseFullAccessViewComponent_ng_container_12_Template_mat_tab_group_selectedIndexChange_1_listener($event) { i0.ɵɵrestoreView(_r34); const ctx_r33 = i0.ɵɵnextContext(); return ctx_r33.tabChanged($event); });
|
|
26779
26780
|
i0.ɵɵtemplate(3, CaseFullAccessViewComponent_ng_container_12_mat_tab_3_Template, 1, 2, "mat-tab", 25);
|
|
26780
26781
|
i0.ɵɵtemplate(4, CaseFullAccessViewComponent_ng_container_12_mat_tab_4_Template, 2, 2, "mat-tab", 25);
|
|
26781
26782
|
i0.ɵɵtemplate(5, CaseFullAccessViewComponent_ng_container_12_mat_tab_5_Template, 1, 2, "mat-tab", 25);
|
|
@@ -26811,6 +26812,7 @@ class CaseFullAccessViewComponent {
|
|
|
26811
26812
|
this.location = location;
|
|
26812
26813
|
this.crf = crf;
|
|
26813
26814
|
this.sessionStorageService = sessionStorageService;
|
|
26815
|
+
this.HEARINGS_TAB_LABEL = 'Hearings';
|
|
26814
26816
|
this.hasPrint = true;
|
|
26815
26817
|
this.hasEventSelector = true;
|
|
26816
26818
|
this.prependedTabs = [];
|
|
@@ -26822,6 +26824,7 @@ class CaseFullAccessViewComponent {
|
|
|
26822
26824
|
this.ignoreWarning = false;
|
|
26823
26825
|
this.selectedTabIndex = 0;
|
|
26824
26826
|
this.activeCaseFlags = false;
|
|
26827
|
+
this.subs = [];
|
|
26825
26828
|
this.callbackErrorsSubject = new Subject();
|
|
26826
26829
|
}
|
|
26827
26830
|
ngOnInit() {
|
|
@@ -26873,6 +26876,7 @@ class CaseFullAccessViewComponent {
|
|
|
26873
26876
|
this.unsubscribe(this.callbackErrorsSubject);
|
|
26874
26877
|
this.unsubscribe(this.errorSubscription);
|
|
26875
26878
|
this.unsubscribe(this.subscription);
|
|
26879
|
+
this.subs.forEach(s => s.unsubscribe());
|
|
26876
26880
|
}
|
|
26877
26881
|
unsubscribe(subscription) {
|
|
26878
26882
|
if (subscription) {
|
|
@@ -26880,19 +26884,22 @@ class CaseFullAccessViewComponent {
|
|
|
26880
26884
|
}
|
|
26881
26885
|
}
|
|
26882
26886
|
checkRouteAndSetCaseViewTab() {
|
|
26883
|
-
this.router.events
|
|
26887
|
+
this.subs.push(this.router.events
|
|
26884
26888
|
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
26885
26889
|
.subscribe((event) => {
|
|
26886
26890
|
const url = event && event.url;
|
|
26887
26891
|
if (url) {
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26892
|
+
if (url.includes('hearings')) {
|
|
26893
|
+
this.selectedTabIndex = this.getTabIndexByTabLabel(this.tabGroup, 'hearings');
|
|
26894
|
+
}
|
|
26895
|
+
else {
|
|
26896
|
+
const urlFragment = this.getUrlFragment(url);
|
|
26897
|
+
const tabLabel = decodeURIComponent(urlFragment);
|
|
26898
|
+
const tabIndex = this.getTabIndexByTabLabel(this.tabGroup, tabLabel);
|
|
26899
|
+
this.selectedTabIndex = tabIndex;
|
|
26893
26900
|
}
|
|
26894
26901
|
}
|
|
26895
|
-
});
|
|
26902
|
+
}));
|
|
26896
26903
|
}
|
|
26897
26904
|
postViewActivity() {
|
|
26898
26905
|
return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
|
|
@@ -27014,22 +27021,19 @@ class CaseFullAccessViewComponent {
|
|
|
27014
27021
|
}
|
|
27015
27022
|
}
|
|
27016
27023
|
}
|
|
27017
|
-
tabChanged(
|
|
27018
|
-
//
|
|
27019
|
-
this.
|
|
27020
|
-
const
|
|
27021
|
-
|
|
27022
|
-
|
|
27023
|
-
|
|
27024
|
-
|
|
27025
|
-
|
|
27026
|
-
this.router.navigate([id], { relativeTo: this.route });
|
|
27024
|
+
tabChanged(tabIndexChanged) {
|
|
27025
|
+
// Refactored under EXUI-110 to address infinite tab loop
|
|
27026
|
+
const matTab = this.tabGroup._tabs.find(tab => tab.isActive);
|
|
27027
|
+
const tabLabel = matTab.textLabel;
|
|
27028
|
+
// if hearings tab don't use fragment for navigation
|
|
27029
|
+
if ((tabIndexChanged <= 1 && this.prependedTabs && this.prependedTabs.length) ||
|
|
27030
|
+
(this.appendedTabs && this.appendedTabs.length && tabLabel === this.HEARINGS_TAB_LABEL)) {
|
|
27031
|
+
// cases/case-details/:caseId/hearings
|
|
27032
|
+
this.router.navigate([tabLabel.toLowerCase()], { relativeTo: this.route });
|
|
27027
27033
|
}
|
|
27028
27034
|
else {
|
|
27029
|
-
|
|
27030
|
-
this.router.navigate(['cases', 'case-details', this.caseDetails.case_id]
|
|
27031
|
-
window.location.hash = label;
|
|
27032
|
-
});
|
|
27035
|
+
// cases/case-details/:caseId#tabLabel
|
|
27036
|
+
this.router.navigate(['cases', 'case-details', this.caseDetails.case_id], { fragment: tabLabel });
|
|
27033
27037
|
}
|
|
27034
27038
|
}
|
|
27035
27039
|
onLinkClicked(triggerOutputEventText) {
|
|
@@ -27125,6 +27129,12 @@ class CaseFullAccessViewComponent {
|
|
|
27125
27129
|
this.callbackErrorsSubject.next(null);
|
|
27126
27130
|
this.alertService.clear();
|
|
27127
27131
|
}
|
|
27132
|
+
getUrlFragment(url) {
|
|
27133
|
+
return url.split('#')[url.split('#').length - 1];
|
|
27134
|
+
}
|
|
27135
|
+
getTabIndexByTabLabel(tabGroup, tabLabel) {
|
|
27136
|
+
return tabGroup._tabs.toArray().findIndex((t) => t.textLabel.toLowerCase() === tabLabel.toLowerCase());
|
|
27137
|
+
}
|
|
27128
27138
|
}
|
|
27129
27139
|
CaseFullAccessViewComponent.ORIGIN_QUERY_PARAM = 'origin';
|
|
27130
27140
|
CaseFullAccessViewComponent.TRIGGER_TEXT_START = 'Go';
|
|
@@ -27137,7 +27147,7 @@ CaseFullAccessViewComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseFullAcces
|
|
|
27137
27147
|
} if (rf & 2) {
|
|
27138
27148
|
let _t;
|
|
27139
27149
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tabGroup = _t.first);
|
|
27140
|
-
} }, inputs: { hasPrint: "hasPrint", hasEventSelector: "hasEventSelector", caseDetails: "caseDetails", prependedTabs: "prependedTabs", appendedTabs: "appendedTabs" }, features: [i0.ɵɵNgOnChangesFeature], decls: 13, vars: 12, consts: [["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [3, "caseId", "displayMode"], [1, "grid-row"], [1, "column-one-half"], [3, "caseDetails"], ["class", "case-viewer-controls", 4, "ngIf"], ["class", "column-one-half", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "column-full"], [4, "ngIf"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h1", "error-summary-heading"], ["id", "edit-case-event_error-summary-body", 1, "govuk-error-summary__body"], ["href", "get-help", "target", "_blank"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h2", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], [4, "ngFor", "ngForOf"], [1, "case-viewer-controls"], ["id", "case-viewer-control-print", "routerLink", "print", 1, "button", "button-secondary"], [3, "isDisabled", "triggers", "triggerText", "onTriggerChange", "onTriggerSubmit"], [3, "notificationBannerConfig", "linkClicked"], ["animationDuration", "0ms", 3, "disableRipple", "selectedIndex", "
|
|
27150
|
+
} }, inputs: { hasPrint: "hasPrint", hasEventSelector: "hasEventSelector", caseDetails: "caseDetails", prependedTabs: "prependedTabs", appendedTabs: "appendedTabs" }, features: [i0.ɵɵNgOnChangesFeature], decls: 13, vars: 12, consts: [["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [3, "caseId", "displayMode"], [1, "grid-row"], [1, "column-one-half"], [3, "caseDetails"], ["class", "case-viewer-controls", 4, "ngIf"], ["class", "column-one-half", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "column-full"], [4, "ngIf"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h1", "error-summary-heading"], ["id", "edit-case-event_error-summary-body", 1, "govuk-error-summary__body"], ["href", "get-help", "target", "_blank"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h2", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], [4, "ngFor", "ngForOf"], [1, "case-viewer-controls"], ["id", "case-viewer-control-print", "routerLink", "print", 1, "button", "button-secondary"], [3, "isDisabled", "triggers", "triggerText", "onTriggerChange", "onTriggerSubmit"], [3, "notificationBannerConfig", "linkClicked"], ["animationDuration", "0ms", 3, "disableRipple", "selectedIndex", "selectedIndexChange"], ["tabGroup", ""], [3, "id", "label", 4, "ngFor", "ngForOf"], [3, "id", "label"], ["matTabContent", ""], ["aria-describedby", "case viewer table"], ["ccdLabelSubstitutor", "", 3, "caseField", "contextFields", "hidden"], [3, "ngSwitch"], [4, "ngSwitchCase"], ["class", "compound-field", 4, "ngSwitchCase"], ["id", "case-viewer-field-label", 4, "ngIf"], ["scope", "col", 3, "id"], [1, "text-16"], [3, "topLevelFormGroup", "caseField", "caseReference", "markdownUseHrefAsRouterLink"], ["id", "case-viewer-field-label"], [1, "case-viewer-label", "text-16"], [1, "compound-field"]], template: function CaseFullAccessViewComponent_Template(rf, ctx) { if (rf & 1) {
|
|
27141
27151
|
i0.ɵɵtemplate(0, CaseFullAccessViewComponent_div_0_Template, 10, 0, "div", 0);
|
|
27142
27152
|
i0.ɵɵtemplate(1, CaseFullAccessViewComponent_div_1_Template, 6, 2, "div", 0);
|
|
27143
27153
|
i0.ɵɵelementStart(2, "ccd-callback-errors", 1);
|