@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
|
@@ -8421,223 +8421,13 @@
|
|
|
8421
8421
|
}], null, null);
|
|
8422
8422
|
})();
|
|
8423
8423
|
|
|
8424
|
-
var MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
8425
|
-
var WorkAllocationService = /** @class */ (function () {
|
|
8426
|
-
function WorkAllocationService(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
8427
|
-
this.http = http;
|
|
8428
|
-
this.appConfig = appConfig;
|
|
8429
|
-
this.errorService = errorService;
|
|
8430
|
-
this.alertService = alertService;
|
|
8431
|
-
this.sessionStorageService = sessionStorageService;
|
|
8432
|
-
// Check to see if work allocation is enabled
|
|
8433
|
-
}
|
|
8434
|
-
/**
|
|
8435
|
-
* Call the API to get tasks matching the search criteria.
|
|
8436
|
-
* @param searchRequest The search parameters that specify which tasks to match.
|
|
8437
|
-
*/
|
|
8438
|
-
WorkAllocationService.prototype.searchTasks = function (searchRequest) {
|
|
8439
|
-
var _this = this;
|
|
8440
|
-
// Do not need to check if WA enabled as parent method will do that
|
|
8441
|
-
var url = this.appConfig.getWorkAllocationApiUrl() + "/searchForCompletable";
|
|
8442
|
-
return this.http
|
|
8443
|
-
.post(url, { searchRequest: searchRequest }, null, false)
|
|
8444
|
-
.pipe(operators.map(function (response) { return response; }), operators.catchError(function (error) {
|
|
8445
|
-
_this.errorService.setError(error);
|
|
8446
|
-
// explicitly eat away 401 error and 400 error
|
|
8447
|
-
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
8448
|
-
// do nothing
|
|
8449
|
-
console.log('error status 401 or 400', error);
|
|
8450
|
-
}
|
|
8451
|
-
else {
|
|
8452
|
-
return rxjs.throwError(error);
|
|
8453
|
-
}
|
|
8454
|
-
}));
|
|
8455
|
-
};
|
|
8456
|
-
WorkAllocationService.prototype.isWAEnabled = function (jurisdiction, caseType) {
|
|
8457
|
-
this.features = this.appConfig.getWAServiceConfig();
|
|
8458
|
-
var enabled = false;
|
|
8459
|
-
if (!jurisdiction || !caseType) {
|
|
8460
|
-
var caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
8461
|
-
jurisdiction = caseInfo.jurisdiction;
|
|
8462
|
-
caseType = caseInfo.caseType;
|
|
8463
|
-
}
|
|
8464
|
-
if (!this.features || !this.features.configurations) {
|
|
8465
|
-
return false;
|
|
8466
|
-
}
|
|
8467
|
-
this.features.configurations.forEach(function (serviceConfig) {
|
|
8468
|
-
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
8469
|
-
enabled = true;
|
|
8470
|
-
}
|
|
8471
|
-
});
|
|
8472
|
-
return enabled;
|
|
8473
|
-
};
|
|
8474
|
-
/**
|
|
8475
|
-
* Call the API to assign a task.
|
|
8476
|
-
* @param taskId specifies which task should be assigned.
|
|
8477
|
-
* @param userId specifies the user the task should be assigned to.
|
|
8478
|
-
*/
|
|
8479
|
-
WorkAllocationService.prototype.assignTask = function (taskId, userId) {
|
|
8480
|
-
var _this = this;
|
|
8481
|
-
if (!this.isWAEnabled()) {
|
|
8482
|
-
return rxjs.of(null);
|
|
8483
|
-
}
|
|
8484
|
-
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/assign";
|
|
8485
|
-
return this.http
|
|
8486
|
-
.post(url, { userId: userId })
|
|
8487
|
-
.pipe(operators.catchError(function (error) {
|
|
8488
|
-
_this.errorService.setError(error);
|
|
8489
|
-
return rxjs.throwError(error);
|
|
8490
|
-
}));
|
|
8491
|
-
};
|
|
8492
|
-
/**
|
|
8493
|
-
* Call the API to complete a task.
|
|
8494
|
-
* @param taskId specifies which task should be completed.
|
|
8495
|
-
*/
|
|
8496
|
-
WorkAllocationService.prototype.completeTask = function (taskId) {
|
|
8497
|
-
var _this = this;
|
|
8498
|
-
if (!this.isWAEnabled()) {
|
|
8499
|
-
return rxjs.of(null);
|
|
8500
|
-
}
|
|
8501
|
-
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
8502
|
-
return this.http
|
|
8503
|
-
.post(url, {})
|
|
8504
|
-
.pipe(operators.catchError(function (error) {
|
|
8505
|
-
_this.errorService.setError(error);
|
|
8506
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
8507
|
-
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
8508
|
-
_this.handleTaskCompletionError(response);
|
|
8509
|
-
});
|
|
8510
|
-
return rxjs.throwError(error);
|
|
8511
|
-
}));
|
|
8512
|
-
};
|
|
8513
|
-
/**
|
|
8514
|
-
* Call the API to assign and complete a task.
|
|
8515
|
-
* @param taskId specifies which task should be completed.
|
|
8516
|
-
*/
|
|
8517
|
-
WorkAllocationService.prototype.assignAndCompleteTask = function (taskId) {
|
|
8518
|
-
var _this = this;
|
|
8519
|
-
if (!this.isWAEnabled()) {
|
|
8520
|
-
return rxjs.of(null);
|
|
8521
|
-
}
|
|
8522
|
-
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
8523
|
-
return this.http
|
|
8524
|
-
.post(url, {
|
|
8525
|
-
completion_options: {
|
|
8526
|
-
assign_and_complete: true
|
|
8527
|
-
}
|
|
8528
|
-
})
|
|
8529
|
-
.pipe(operators.catchError(function (error) {
|
|
8530
|
-
_this.errorService.setError(error);
|
|
8531
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
8532
|
-
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
8533
|
-
_this.handleTaskCompletionError(response);
|
|
8534
|
-
});
|
|
8535
|
-
return rxjs.throwError(error);
|
|
8536
|
-
}));
|
|
8537
|
-
};
|
|
8538
|
-
/**
|
|
8539
|
-
* Handles the response from the observable to get the user details when task is completed.
|
|
8540
|
-
* @param response is the response given from the observable which contains the user detaild.
|
|
8541
|
-
*/
|
|
8542
|
-
WorkAllocationService.prototype.handleTaskCompletionError = function (response) {
|
|
8543
|
-
var userDetails = response;
|
|
8544
|
-
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
8545
|
-
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
8546
|
-
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
8547
|
-
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
8548
|
-
}
|
|
8549
|
-
};
|
|
8550
|
-
/**
|
|
8551
|
-
* Returns true if the user's role is equivalent to a caseworker.
|
|
8552
|
-
* @param roles is the list of roles found from the current user.
|
|
8553
|
-
*/
|
|
8554
|
-
WorkAllocationService.prototype.userIsCaseworker = function (roles) {
|
|
8555
|
-
var lowerCaseRoles = roles.map(function (role) { return role.toLowerCase(); });
|
|
8556
|
-
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
8557
|
-
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
8558
|
-
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
8559
|
-
};
|
|
8560
|
-
/**
|
|
8561
|
-
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
8562
|
-
* 1. No tasks found => Success.
|
|
8563
|
-
* 2. One task found => Mark as done => Success.
|
|
8564
|
-
* 3. One task found => Mark as done throws error => Failure.
|
|
8565
|
-
* 4. More than one task found => Failure.
|
|
8566
|
-
* 5. Search call throws an error => Failure.
|
|
8567
|
-
* @param ccdId The ID of the case to find tasks for.
|
|
8568
|
-
* @param eventId The ID of the event to find tasks for.
|
|
8569
|
-
*/
|
|
8570
|
-
WorkAllocationService.prototype.completeAppropriateTask = function (ccdId, eventId, jurisdiction, caseTypeId) {
|
|
8571
|
-
var _this = this;
|
|
8572
|
-
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
8573
|
-
return rxjs.of(null);
|
|
8574
|
-
}
|
|
8575
|
-
var taskSearchParameter = {
|
|
8576
|
-
ccdId: ccdId,
|
|
8577
|
-
eventId: eventId,
|
|
8578
|
-
jurisdiction: jurisdiction,
|
|
8579
|
-
caseTypeId: caseTypeId
|
|
8580
|
-
};
|
|
8581
|
-
return this.searchTasks(taskSearchParameter)
|
|
8582
|
-
.pipe(operators.map(function (response) {
|
|
8583
|
-
var tasks = response.tasks;
|
|
8584
|
-
if (tasks && tasks.length > 0) {
|
|
8585
|
-
if (tasks.length === 1) {
|
|
8586
|
-
_this.completeTask(tasks[0].id).subscribe();
|
|
8587
|
-
}
|
|
8588
|
-
else {
|
|
8589
|
-
// This is a problem. Throw an appropriate error.
|
|
8590
|
-
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
8591
|
-
}
|
|
8592
|
-
}
|
|
8593
|
-
return true; // All good. Nothing to see here.
|
|
8594
|
-
}), operators.catchError(function (error) {
|
|
8595
|
-
// Simply rethrow it.
|
|
8596
|
-
return rxjs.throwError(error);
|
|
8597
|
-
}));
|
|
8598
|
-
};
|
|
8599
|
-
/**
|
|
8600
|
-
* Return tasks for case and event.
|
|
8601
|
-
*/
|
|
8602
|
-
WorkAllocationService.prototype.getTasksByCaseIdAndEventId = function (eventId, caseId, caseType, jurisdiction) {
|
|
8603
|
-
var defaultPayload = {
|
|
8604
|
-
task_required_for_event: false,
|
|
8605
|
-
tasks: []
|
|
8606
|
-
};
|
|
8607
|
-
if (!this.isWAEnabled()) {
|
|
8608
|
-
return rxjs.of(defaultPayload);
|
|
8609
|
-
}
|
|
8610
|
-
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/case/tasks/" + caseId + "/event/" + eventId + "/caseType/" + caseType + "/jurisdiction/" + jurisdiction);
|
|
8611
|
-
};
|
|
8612
|
-
/**
|
|
8613
|
-
* Call the API to get a task
|
|
8614
|
-
*/
|
|
8615
|
-
WorkAllocationService.prototype.getTask = function (taskId) {
|
|
8616
|
-
if (!this.isWAEnabled()) {
|
|
8617
|
-
return rxjs.of({ task: null });
|
|
8618
|
-
}
|
|
8619
|
-
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId);
|
|
8620
|
-
};
|
|
8621
|
-
return WorkAllocationService;
|
|
8622
|
-
}());
|
|
8623
|
-
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
8624
|
-
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
8625
|
-
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(AlertService), i0__namespace.ɵɵinject(SessionStorageService)); };
|
|
8626
|
-
WorkAllocationService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
8627
|
-
(function () {
|
|
8628
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(WorkAllocationService, [{
|
|
8629
|
-
type: i0.Injectable
|
|
8630
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
|
|
8631
|
-
})();
|
|
8632
|
-
|
|
8633
8424
|
var CasesService = /** @class */ (function () {
|
|
8634
|
-
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper,
|
|
8425
|
+
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService) {
|
|
8635
8426
|
this.http = http;
|
|
8636
8427
|
this.appConfig = appConfig;
|
|
8637
8428
|
this.orderService = orderService;
|
|
8638
8429
|
this.errorService = errorService;
|
|
8639
8430
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
8640
|
-
this.workAllocationService = workAllocationService;
|
|
8641
8431
|
this.loadingService = loadingService;
|
|
8642
8432
|
this.sessionStorageService = sessionStorageService;
|
|
8643
8433
|
this.get = this.getCaseView;
|
|
@@ -8872,12 +8662,12 @@
|
|
|
8872
8662
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
8873
8663
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
8874
8664
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
8875
|
-
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(OrderService), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0__namespace.ɵɵinject(
|
|
8665
|
+
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(OrderService), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0__namespace.ɵɵinject(LoadingService), i0__namespace.ɵɵinject(SessionStorageService)); };
|
|
8876
8666
|
CasesService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8877
8667
|
(function () {
|
|
8878
8668
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CasesService, [{
|
|
8879
8669
|
type: i0.Injectable
|
|
8880
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type:
|
|
8670
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }]; }, null);
|
|
8881
8671
|
})();
|
|
8882
8672
|
|
|
8883
8673
|
var EventTriggerService = /** @class */ (function () {
|
|
@@ -9531,6 +9321,215 @@
|
|
|
9531
9321
|
}], function () { return [{ type: CaseFieldService }]; }, null);
|
|
9532
9322
|
})();
|
|
9533
9323
|
|
|
9324
|
+
var MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
9325
|
+
var WorkAllocationService = /** @class */ (function () {
|
|
9326
|
+
function WorkAllocationService(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
9327
|
+
this.http = http;
|
|
9328
|
+
this.appConfig = appConfig;
|
|
9329
|
+
this.errorService = errorService;
|
|
9330
|
+
this.alertService = alertService;
|
|
9331
|
+
this.sessionStorageService = sessionStorageService;
|
|
9332
|
+
// Check to see if work allocation is enabled
|
|
9333
|
+
}
|
|
9334
|
+
/**
|
|
9335
|
+
* Call the API to get tasks matching the search criteria.
|
|
9336
|
+
* @param searchRequest The search parameters that specify which tasks to match.
|
|
9337
|
+
*/
|
|
9338
|
+
WorkAllocationService.prototype.searchTasks = function (searchRequest) {
|
|
9339
|
+
var _this = this;
|
|
9340
|
+
// Do not need to check if WA enabled as parent method will do that
|
|
9341
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/searchForCompletable";
|
|
9342
|
+
return this.http
|
|
9343
|
+
.post(url, { searchRequest: searchRequest }, null, false)
|
|
9344
|
+
.pipe(operators.map(function (response) { return response; }), operators.catchError(function (error) {
|
|
9345
|
+
_this.errorService.setError(error);
|
|
9346
|
+
// explicitly eat away 401 error and 400 error
|
|
9347
|
+
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
9348
|
+
// do nothing
|
|
9349
|
+
console.log('error status 401 or 400', error);
|
|
9350
|
+
}
|
|
9351
|
+
else {
|
|
9352
|
+
return rxjs.throwError(error);
|
|
9353
|
+
}
|
|
9354
|
+
}));
|
|
9355
|
+
};
|
|
9356
|
+
WorkAllocationService.prototype.isWAEnabled = function (jurisdiction, caseType) {
|
|
9357
|
+
this.features = this.appConfig.getWAServiceConfig();
|
|
9358
|
+
var enabled = false;
|
|
9359
|
+
if (!jurisdiction || !caseType) {
|
|
9360
|
+
var caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
9361
|
+
jurisdiction = caseInfo.jurisdiction;
|
|
9362
|
+
caseType = caseInfo.caseType;
|
|
9363
|
+
}
|
|
9364
|
+
if (!this.features || !this.features.configurations) {
|
|
9365
|
+
return false;
|
|
9366
|
+
}
|
|
9367
|
+
this.features.configurations.forEach(function (serviceConfig) {
|
|
9368
|
+
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
9369
|
+
enabled = true;
|
|
9370
|
+
}
|
|
9371
|
+
});
|
|
9372
|
+
return enabled;
|
|
9373
|
+
};
|
|
9374
|
+
/**
|
|
9375
|
+
* Call the API to assign a task.
|
|
9376
|
+
* @param taskId specifies which task should be assigned.
|
|
9377
|
+
* @param userId specifies the user the task should be assigned to.
|
|
9378
|
+
*/
|
|
9379
|
+
WorkAllocationService.prototype.assignTask = function (taskId, userId) {
|
|
9380
|
+
var _this = this;
|
|
9381
|
+
if (!this.isWAEnabled()) {
|
|
9382
|
+
return rxjs.of(null);
|
|
9383
|
+
}
|
|
9384
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/assign";
|
|
9385
|
+
return this.http
|
|
9386
|
+
.post(url, { userId: userId })
|
|
9387
|
+
.pipe(operators.catchError(function (error) {
|
|
9388
|
+
_this.errorService.setError(error);
|
|
9389
|
+
return rxjs.throwError(error);
|
|
9390
|
+
}));
|
|
9391
|
+
};
|
|
9392
|
+
/**
|
|
9393
|
+
* Call the API to complete a task.
|
|
9394
|
+
* @param taskId specifies which task should be completed.
|
|
9395
|
+
*/
|
|
9396
|
+
WorkAllocationService.prototype.completeTask = function (taskId) {
|
|
9397
|
+
var _this = this;
|
|
9398
|
+
if (!this.isWAEnabled()) {
|
|
9399
|
+
return rxjs.of(null);
|
|
9400
|
+
}
|
|
9401
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
9402
|
+
return this.http
|
|
9403
|
+
.post(url, {})
|
|
9404
|
+
.pipe(operators.catchError(function (error) {
|
|
9405
|
+
_this.errorService.setError(error);
|
|
9406
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
9407
|
+
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
9408
|
+
_this.handleTaskCompletionError(response);
|
|
9409
|
+
});
|
|
9410
|
+
return rxjs.throwError(error);
|
|
9411
|
+
}));
|
|
9412
|
+
};
|
|
9413
|
+
/**
|
|
9414
|
+
* Call the API to assign and complete a task.
|
|
9415
|
+
* @param taskId specifies which task should be completed.
|
|
9416
|
+
*/
|
|
9417
|
+
WorkAllocationService.prototype.assignAndCompleteTask = function (taskId) {
|
|
9418
|
+
var _this = this;
|
|
9419
|
+
if (!this.isWAEnabled()) {
|
|
9420
|
+
return rxjs.of(null);
|
|
9421
|
+
}
|
|
9422
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
9423
|
+
return this.http
|
|
9424
|
+
.post(url, {
|
|
9425
|
+
completion_options: {
|
|
9426
|
+
assign_and_complete: true
|
|
9427
|
+
}
|
|
9428
|
+
})
|
|
9429
|
+
.pipe(operators.catchError(function (error) {
|
|
9430
|
+
_this.errorService.setError(error);
|
|
9431
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
9432
|
+
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
9433
|
+
_this.handleTaskCompletionError(response);
|
|
9434
|
+
});
|
|
9435
|
+
return rxjs.throwError(error);
|
|
9436
|
+
}));
|
|
9437
|
+
};
|
|
9438
|
+
/**
|
|
9439
|
+
* Handles the response from the observable to get the user details when task is completed.
|
|
9440
|
+
* @param response is the response given from the observable which contains the user detaild.
|
|
9441
|
+
*/
|
|
9442
|
+
WorkAllocationService.prototype.handleTaskCompletionError = function (response) {
|
|
9443
|
+
var userDetails = response;
|
|
9444
|
+
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
9445
|
+
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
9446
|
+
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
9447
|
+
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
9448
|
+
}
|
|
9449
|
+
};
|
|
9450
|
+
/**
|
|
9451
|
+
* Returns true if the user's role is equivalent to a caseworker.
|
|
9452
|
+
* @param roles is the list of roles found from the current user.
|
|
9453
|
+
*/
|
|
9454
|
+
WorkAllocationService.prototype.userIsCaseworker = function (roles) {
|
|
9455
|
+
var lowerCaseRoles = roles.map(function (role) { return role.toLowerCase(); });
|
|
9456
|
+
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
9457
|
+
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
9458
|
+
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
9459
|
+
};
|
|
9460
|
+
/**
|
|
9461
|
+
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
9462
|
+
* 1. No tasks found => Success.
|
|
9463
|
+
* 2. One task found => Mark as done => Success.
|
|
9464
|
+
* 3. One task found => Mark as done throws error => Failure.
|
|
9465
|
+
* 4. More than one task found => Failure.
|
|
9466
|
+
* 5. Search call throws an error => Failure.
|
|
9467
|
+
* @param ccdId The ID of the case to find tasks for.
|
|
9468
|
+
* @param eventId The ID of the event to find tasks for.
|
|
9469
|
+
*/
|
|
9470
|
+
WorkAllocationService.prototype.completeAppropriateTask = function (ccdId, eventId, jurisdiction, caseTypeId) {
|
|
9471
|
+
var _this = this;
|
|
9472
|
+
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
9473
|
+
return rxjs.of(null);
|
|
9474
|
+
}
|
|
9475
|
+
var taskSearchParameter = {
|
|
9476
|
+
ccdId: ccdId,
|
|
9477
|
+
eventId: eventId,
|
|
9478
|
+
jurisdiction: jurisdiction,
|
|
9479
|
+
caseTypeId: caseTypeId
|
|
9480
|
+
};
|
|
9481
|
+
return this.searchTasks(taskSearchParameter)
|
|
9482
|
+
.pipe(operators.map(function (response) {
|
|
9483
|
+
var tasks = response.tasks;
|
|
9484
|
+
if (tasks && tasks.length > 0) {
|
|
9485
|
+
if (tasks.length === 1) {
|
|
9486
|
+
_this.completeTask(tasks[0].id).subscribe();
|
|
9487
|
+
}
|
|
9488
|
+
else {
|
|
9489
|
+
// This is a problem. Throw an appropriate error.
|
|
9490
|
+
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
9491
|
+
}
|
|
9492
|
+
}
|
|
9493
|
+
return true; // All good. Nothing to see here.
|
|
9494
|
+
}), operators.catchError(function (error) {
|
|
9495
|
+
// Simply rethrow it.
|
|
9496
|
+
return rxjs.throwError(error);
|
|
9497
|
+
}));
|
|
9498
|
+
};
|
|
9499
|
+
/**
|
|
9500
|
+
* Return tasks for case and event.
|
|
9501
|
+
*/
|
|
9502
|
+
WorkAllocationService.prototype.getTasksByCaseIdAndEventId = function (eventId, caseId, caseType, jurisdiction) {
|
|
9503
|
+
var defaultPayload = {
|
|
9504
|
+
task_required_for_event: false,
|
|
9505
|
+
tasks: []
|
|
9506
|
+
};
|
|
9507
|
+
if (!this.isWAEnabled()) {
|
|
9508
|
+
return rxjs.of(defaultPayload);
|
|
9509
|
+
}
|
|
9510
|
+
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/case/tasks/" + caseId + "/event/" + eventId + "/caseType/" + caseType + "/jurisdiction/" + jurisdiction);
|
|
9511
|
+
};
|
|
9512
|
+
/**
|
|
9513
|
+
* Call the API to get a task
|
|
9514
|
+
*/
|
|
9515
|
+
WorkAllocationService.prototype.getTask = function (taskId) {
|
|
9516
|
+
if (!this.isWAEnabled()) {
|
|
9517
|
+
return rxjs.of({ task: null });
|
|
9518
|
+
}
|
|
9519
|
+
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId);
|
|
9520
|
+
};
|
|
9521
|
+
return WorkAllocationService;
|
|
9522
|
+
}());
|
|
9523
|
+
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
9524
|
+
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
9525
|
+
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(AlertService), i0__namespace.ɵɵinject(SessionStorageService)); };
|
|
9526
|
+
WorkAllocationService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
9527
|
+
(function () {
|
|
9528
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(WorkAllocationService, [{
|
|
9529
|
+
type: i0.Injectable
|
|
9530
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
|
|
9531
|
+
})();
|
|
9532
|
+
|
|
9534
9533
|
var CaseEditComponent = /** @class */ (function () {
|
|
9535
9534
|
function CaseEditComponent(fb, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService) {
|
|
9536
9535
|
this.fb = fb;
|
|
@@ -19135,9 +19134,6 @@
|
|
|
19135
19134
|
PaymentField.prototype.getRefundsUrl = function () {
|
|
19136
19135
|
return this.appConfig.getRefundsUrl();
|
|
19137
19136
|
};
|
|
19138
|
-
PaymentField.prototype.getNotificationUrl = function () {
|
|
19139
|
-
return this.appConfig.getNotificationUrl();
|
|
19140
|
-
};
|
|
19141
19137
|
PaymentField.prototype.getUserRoles = function () {
|
|
19142
19138
|
var userDetails = JSON.parse(this.sessionStorage.getItem('userDetails') || null);
|
|
19143
19139
|
if (!userDetails || !userDetails.hasOwnProperty('roles')) {
|
|
@@ -19163,12 +19159,12 @@
|
|
|
19163
19159
|
return CasePaymentHistoryViewerFieldComponent;
|
|
19164
19160
|
}(PaymentField));
|
|
19165
19161
|
CasePaymentHistoryViewerFieldComponent.ɵfac = function CasePaymentHistoryViewerFieldComponent_Factory(t) { return new (t || CasePaymentHistoryViewerFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(SessionStorageService)); };
|
|
19166
|
-
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 1, vars:
|
|
19162
|
+
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0__namespace.ɵɵ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) {
|
|
19167
19163
|
if (rf & 1) {
|
|
19168
19164
|
i0__namespace.ɵɵelement(0, "ccpay-payment-lib", 0);
|
|
19169
19165
|
}
|
|
19170
19166
|
if (rf & 2) {
|
|
19171
|
-
i0__namespace.ɵɵ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())("
|
|
19167
|
+
i0__namespace.ɵɵ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");
|
|
19172
19168
|
}
|
|
19173
19169
|
}, directives: [i3__namespace.PaymentLibComponent], encapsulation: 2 });
|
|
19174
19170
|
(function () {
|
|
@@ -19801,7 +19797,7 @@
|
|
|
19801
19797
|
}
|
|
19802
19798
|
if (rf & 2) {
|
|
19803
19799
|
var ctx_r0 = i0__namespace.ɵɵnextContext();
|
|
19804
|
-
i0__namespace.ɵɵproperty("API_ROOT", ctx_r0.getBaseURL())("BULKSCAN_API_ROOT", ctx_r0.getPayBulkScanBaseURL())("REFUNDS_API_ROOT", ctx_r0.getRefundsUrl())("
|
|
19800
|
+
i0__namespace.ɵɵ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");
|
|
19805
19801
|
}
|
|
19806
19802
|
}
|
|
19807
19803
|
var WaysToPayFieldComponent = /** @class */ (function (_super) {
|
|
@@ -19815,9 +19811,9 @@
|
|
|
19815
19811
|
return WaysToPayFieldComponent;
|
|
19816
19812
|
}(PaymentField));
|
|
19817
19813
|
WaysToPayFieldComponent.ɵfac = function WaysToPayFieldComponent_Factory(t) { return new (t || WaysToPayFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(SessionStorageService)); };
|
|
19818
|
-
WaysToPayFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "
|
|
19814
|
+
WaysToPayFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0__namespace.ɵɵ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) {
|
|
19819
19815
|
if (rf & 1) {
|
|
19820
|
-
i0__namespace.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1,
|
|
19816
|
+
i0__namespace.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1, 14, "ccpay-payment-lib", 0);
|
|
19821
19817
|
}
|
|
19822
19818
|
if (rf & 2) {
|
|
19823
19819
|
i0__namespace.ɵɵproperty("ngIf", ctx.getUserRoles().length > 0);
|
|
@@ -26072,7 +26068,7 @@
|
|
|
26072
26068
|
i0__namespace.ɵɵsetComponentScope(WriteCollectionFieldComponent, [i1__namespace.NgIf, i1__namespace.NgForOf, FieldWriteComponent, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective], [FieldLabelPipe, FirstErrorPipe]);
|
|
26073
26069
|
i0__namespace.ɵɵsetComponentScope(
|
|
26074
26070
|
// ComponentLauncher web components
|
|
26075
|
-
CaseFileViewFieldComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace
|
|
26071
|
+
CaseFileViewFieldComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace.MediaViewerComponent], []);
|
|
26076
26072
|
i0__namespace.ɵɵsetComponentScope(LinkedCasesToTableComponent, [i1__namespace.NgIf, i1__namespace.NgForOf], [CaseReferencePipe, LinkCasesReasonValuePipe]);
|
|
26077
26073
|
i0__namespace.ɵɵsetComponentScope(LinkedCasesFromTableComponent, [i1__namespace.NgIf, i1__namespace.NgForOf], [CaseReferencePipe, LinkCasesFromReasonValuePipe]);
|
|
26078
26074
|
i0__namespace.ɵɵsetComponentScope(LinkCasesComponent, [i1__namespace.NgIf, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective, i1__namespace.NgClass, i2__namespace.DefaultValueAccessor, i2__namespace.NgControlStatus, i2__namespace.FormControlName, i2__namespace.FormArrayName, i1__namespace.NgForOf, i2__namespace.FormGroupName, i2__namespace.CheckboxControlValueAccessor], [CaseReferencePipe, LinkCasesReasonValuePipe]);
|