@hmcts/ccd-case-ui-toolkit 6.14.1 → 6.14.4-eui-4157
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 +218 -222
- 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/app.config.js +1 -1
- package/esm2015/lib/shared/components/case-editor/services/cases.service.js +4 -7
- package/esm2015/lib/shared/components/palette/base-field/payment-field.component.js +1 -4
- package/esm2015/lib/shared/components/palette/palette.module.js +1 -1
- package/esm2015/lib/shared/components/palette/payment/case-payment-history-viewer-field.component.js +3 -3
- package/esm2015/lib/shared/components/palette/waystopay/waystopay-field.component.js +4 -4
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +210 -214
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/app.config.d.ts +0 -2
- package/lib/app.config.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts +1 -3
- package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/lib/shared/components/palette/base-field/payment-field.component.d.ts +0 -1
- package/lib/shared/components/palette/base-field/payment-field.component.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -7210,215 +7210,13 @@ 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
|
-
|
|
7414
7213
|
class CasesService {
|
|
7415
|
-
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper,
|
|
7214
|
+
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService) {
|
|
7416
7215
|
this.http = http;
|
|
7417
7216
|
this.appConfig = appConfig;
|
|
7418
7217
|
this.orderService = orderService;
|
|
7419
7218
|
this.errorService = errorService;
|
|
7420
7219
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
7421
|
-
this.workAllocationService = workAllocationService;
|
|
7422
7220
|
this.loadingService = loadingService;
|
|
7423
7221
|
this.sessionStorageService = sessionStorageService;
|
|
7424
7222
|
this.get = this.getCaseView;
|
|
@@ -7644,11 +7442,11 @@ CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE = 'application/vnd.uk.gov.hmcts.ccd
|
|
|
7644
7442
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
7645
7443
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
7646
7444
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
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(
|
|
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)); };
|
|
7648
7446
|
CasesService.ɵprov = i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
7649
7447
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasesService, [{
|
|
7650
7448
|
type: Injectable
|
|
7651
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type:
|
|
7449
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }]; }, null); })();
|
|
7652
7450
|
|
|
7653
7451
|
class EventTriggerService {
|
|
7654
7452
|
constructor() {
|
|
@@ -8251,6 +8049,207 @@ PageValidationService.ɵprov = i0.ɵɵdefineInjectable({ token: PageValidationSe
|
|
|
8251
8049
|
type: Injectable
|
|
8252
8050
|
}], function () { return [{ type: CaseFieldService }]; }, null); })();
|
|
8253
8051
|
|
|
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
|
+
|
|
8254
8253
|
class CaseEditComponent {
|
|
8255
8254
|
constructor(fb, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService) {
|
|
8256
8255
|
this.fb = fb;
|
|
@@ -16608,9 +16607,6 @@ class PaymentField extends AbstractFieldReadComponent {
|
|
|
16608
16607
|
getRefundsUrl() {
|
|
16609
16608
|
return this.appConfig.getRefundsUrl();
|
|
16610
16609
|
}
|
|
16611
|
-
getNotificationUrl() {
|
|
16612
|
-
return this.appConfig.getNotificationUrl();
|
|
16613
|
-
}
|
|
16614
16610
|
getUserRoles() {
|
|
16615
16611
|
const userDetails = JSON.parse(this.sessionStorage.getItem('userDetails') || null);
|
|
16616
16612
|
if (!userDetails || !userDetails.hasOwnProperty('roles')) {
|
|
@@ -16633,10 +16629,10 @@ class CasePaymentHistoryViewerFieldComponent extends PaymentField {
|
|
|
16633
16629
|
}
|
|
16634
16630
|
}
|
|
16635
16631
|
CasePaymentHistoryViewerFieldComponent.ɵfac = function CasePaymentHistoryViewerFieldComponent_Factory(t) { return new (t || CasePaymentHistoryViewerFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(SessionStorageService)); };
|
|
16636
|
-
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars:
|
|
16632
|
+
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 15, consts: [[3, "API_ROOT", "CCD_CASE_NUMBER", "BULKSCAN_API_ROOT", "SELECTED_OPTION", "ISBSENABLE", "LOGGEDINUSEREMAIL", "LOGGEDINUSERROLES", "REFUNDS_API_ROOT", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "ISPAYMENTSTATUSENABLED"]], template: function CasePaymentHistoryViewerFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
16637
16633
|
i0.ɵɵelement(0, "ccpay-payment-lib", 0);
|
|
16638
16634
|
} if (rf & 2) {
|
|
16639
|
-
i0.ɵɵproperty("API_ROOT", ctx.getBaseURL())("CCD_CASE_NUMBER", ctx.caseReference)("BULKSCAN_API_ROOT", ctx.getPayBulkScanBaseURL())("SELECTED_OPTION", "CCDorException")("ISBSENABLE", "true")("LOGGEDINUSEREMAIL", ctx.getUserEmail())("LOGGEDINUSERROLES", ctx.getUserRoles())("REFUNDS_API_ROOT", ctx.getRefundsUrl())("
|
|
16635
|
+
i0.ɵɵproperty("API_ROOT", ctx.getBaseURL())("CCD_CASE_NUMBER", ctx.caseReference)("BULKSCAN_API_ROOT", ctx.getPayBulkScanBaseURL())("SELECTED_OPTION", "CCDorException")("ISBSENABLE", "true")("LOGGEDINUSEREMAIL", ctx.getUserEmail())("LOGGEDINUSERROLES", ctx.getUserRoles())("REFUNDS_API_ROOT", ctx.getRefundsUrl())("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", false)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx.caseReference)("DCN_NUMBER", null)("ISPAYMENTSTATUSENABLED", "Enable");
|
|
16640
16636
|
} }, directives: [i3.PaymentLibComponent], encapsulation: 2 });
|
|
16641
16637
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasePaymentHistoryViewerFieldComponent, [{
|
|
16642
16638
|
type: Component,
|
|
@@ -17135,7 +17131,7 @@ function WaysToPayFieldComponent_ccpay_payment_lib_0_Template(rf, ctx) { if (rf
|
|
|
17135
17131
|
i0.ɵɵelement(0, "ccpay-payment-lib", 1);
|
|
17136
17132
|
} if (rf & 2) {
|
|
17137
17133
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
17138
|
-
i0.ɵɵproperty("API_ROOT", ctx_r0.getBaseURL())("BULKSCAN_API_ROOT", ctx_r0.getPayBulkScanBaseURL())("REFUNDS_API_ROOT", ctx_r0.getRefundsUrl())("
|
|
17134
|
+
i0.ɵɵproperty("API_ROOT", ctx_r0.getBaseURL())("BULKSCAN_API_ROOT", ctx_r0.getPayBulkScanBaseURL())("REFUNDS_API_ROOT", ctx_r0.getRefundsUrl())("CCD_CASE_NUMBER", ctx_r0.caseReference)("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", true)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx_r0.caseReference)("DCN_NUMBER", null)("SELECTED_OPTION", "CCDorException")("LOGGEDINUSERROLES", ctx_r0.getUserRoles())("CARDPAYMENTRETURNURL", ctx_r0.getCardPaymentReturnUrl())("ISPAYMENTSTATUSENABLED", "Enable");
|
|
17139
17135
|
} }
|
|
17140
17136
|
class WaysToPayFieldComponent extends PaymentField {
|
|
17141
17137
|
constructor(appConfig, sessionStorage) {
|
|
@@ -17146,8 +17142,8 @@ class WaysToPayFieldComponent extends PaymentField {
|
|
|
17146
17142
|
}
|
|
17147
17143
|
}
|
|
17148
17144
|
WaysToPayFieldComponent.ɵfac = function WaysToPayFieldComponent_Factory(t) { return new (t || WaysToPayFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(SessionStorageService)); };
|
|
17149
|
-
WaysToPayFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "
|
|
17150
|
-
i0.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1,
|
|
17145
|
+
WaysToPayFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED", 4, "ngIf"], [3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED"]], template: function WaysToPayFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
17146
|
+
i0.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1, 14, "ccpay-payment-lib", 0);
|
|
17151
17147
|
} if (rf & 2) {
|
|
17152
17148
|
i0.ɵɵproperty("ngIf", ctx.getUserRoles().length > 0);
|
|
17153
17149
|
} }, directives: [i1.NgIf, i3.PaymentLibComponent], encapsulation: 2 });
|
|
@@ -22690,7 +22686,7 @@ i0.ɵɵsetComponentScope(WriteDateContainerFieldComponent, [i1.NgIf, DatetimePic
|
|
|
22690
22686
|
i0.ɵɵsetComponentScope(WriteCollectionFieldComponent, [i1.NgIf, i1.NgForOf, FieldWriteComponent, i2.NgControlStatusGroup, i2.FormGroupDirective], [FieldLabelPipe, FirstErrorPipe]);
|
|
22691
22687
|
i0.ɵɵsetComponentScope(
|
|
22692
22688
|
// ComponentLauncher web components
|
|
22693
|
-
CaseFileViewFieldComponent, [i1.NgIf, CaseFileViewFolderComponent, i11
|
|
22689
|
+
CaseFileViewFieldComponent, [i1.NgIf, CaseFileViewFolderComponent, i11.MediaViewerComponent], []);
|
|
22694
22690
|
i0.ɵɵsetComponentScope(LinkedCasesToTableComponent, [i1.NgIf, i1.NgForOf], [CaseReferencePipe, LinkCasesReasonValuePipe]);
|
|
22695
22691
|
i0.ɵɵsetComponentScope(LinkedCasesFromTableComponent, [i1.NgIf, i1.NgForOf], [CaseReferencePipe, LinkCasesFromReasonValuePipe]);
|
|
22696
22692
|
i0.ɵɵsetComponentScope(LinkCasesComponent, [i1.NgIf, i2.NgControlStatusGroup, i2.FormGroupDirective, i1.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlName, i2.FormArrayName, i1.NgForOf, i2.FormGroupName, i2.CheckboxControlValueAccessor], [CaseReferencePipe, LinkCasesReasonValuePipe]);
|