@hmcts/ccd-case-ui-toolkit 6.13.10-g-eui-4157-c → 6.13.10-linked-cases-continue-button-validation-v4
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/RELEASE-NOTES.md +3 -0
- package/dist/ccd-case-ui-toolkit/bundles/hmcts-ccd-case-ui-toolkit.umd.js +279 -312
- package/dist/ccd-case-ui-toolkit/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/dist/ccd-case-ui-toolkit/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/dist/ccd-case-ui-toolkit/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/commons/case-edit-data/case-edit-data.service.js +5 -8
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +21 -3
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/components/case-editor/services/cases.service.js +7 -4
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/components/palette/linked-cases/domain/linked-cases-state.model.js +1 -1
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.js +36 -86
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/components/palette/palette.module.js +2 -2
- package/dist/ccd-case-ui-toolkit/esm2015/lib/shared/services/fields/fields.utils.js +8 -1
- package/dist/ccd-case-ui-toolkit/fesm2015/hmcts-ccd-case-ui-toolkit.js +271 -298
- package/dist/ccd-case-ui-toolkit/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts +3 -5
- package/dist/ccd-case-ui-toolkit/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +2 -0
- package/dist/ccd-case-ui-toolkit/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/components/case-editor/services/cases.service.d.ts +3 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/components/palette/linked-cases/domain/linked-cases-state.model.d.ts +0 -4
- package/dist/ccd-case-ui-toolkit/lib/shared/components/palette/linked-cases/domain/linked-cases-state.model.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts +0 -4
- package/dist/ccd-case-ui-toolkit/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/lib/shared/services/fields/fields.utils.d.ts +2 -0
- package/dist/ccd-case-ui-toolkit/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/dist/ccd-case-ui-toolkit/package.json +1 -1
- package/package.json +1 -1
- package/projects/ccd-case-ui-toolkit/package.json +1 -1
- package/projects/ccd-case-ui-toolkit/src/lib/shared/commons/case-edit-data/case-edit-data.service.ts +4 -9
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.ts +21 -2
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/cases.service.spec.ts +1 -1
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/cases.service.ts +1 -0
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/linked-cases/domain/linked-cases-state.model.ts +0 -5
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.html +0 -13
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.spec.ts +4 -19
- package/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.ts +8 -31
- package/projects/ccd-case-ui-toolkit/src/lib/shared/services/fields/fields.utils.spec.ts +44 -0
- package/projects/ccd-case-ui-toolkit/src/lib/shared/services/fields/fields.utils.ts +10 -1
|
@@ -4144,6 +4144,13 @@
|
|
|
4144
4144
|
}
|
|
4145
4145
|
return caseField.field_type.type === 'ComponentLauncher';
|
|
4146
4146
|
};
|
|
4147
|
+
FieldsUtils.isLinkedCasesCaseField = function (caseField) {
|
|
4148
|
+
return FieldsUtils.isComponentLauncherCaseField(caseField) &&
|
|
4149
|
+
caseField.id === 'LinkedCasesComponentLauncher';
|
|
4150
|
+
};
|
|
4151
|
+
FieldsUtils.containsLinkedCasesCaseField = function (caseFields) {
|
|
4152
|
+
return caseFields === null || caseFields === void 0 ? void 0 : caseFields.some(function (caseField) { return FieldsUtils.isLinkedCasesCaseField(caseField); });
|
|
4153
|
+
};
|
|
4147
4154
|
FieldsUtils.isFlagsFieldType = function (fieldType) {
|
|
4148
4155
|
if (!fieldType) {
|
|
4149
4156
|
return false;
|
|
@@ -8421,13 +8428,223 @@
|
|
|
8421
8428
|
}], null, null);
|
|
8422
8429
|
})();
|
|
8423
8430
|
|
|
8431
|
+
var MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
8432
|
+
var WorkAllocationService = /** @class */ (function () {
|
|
8433
|
+
function WorkAllocationService(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
8434
|
+
this.http = http;
|
|
8435
|
+
this.appConfig = appConfig;
|
|
8436
|
+
this.errorService = errorService;
|
|
8437
|
+
this.alertService = alertService;
|
|
8438
|
+
this.sessionStorageService = sessionStorageService;
|
|
8439
|
+
// Check to see if work allocation is enabled
|
|
8440
|
+
}
|
|
8441
|
+
/**
|
|
8442
|
+
* Call the API to get tasks matching the search criteria.
|
|
8443
|
+
* @param searchRequest The search parameters that specify which tasks to match.
|
|
8444
|
+
*/
|
|
8445
|
+
WorkAllocationService.prototype.searchTasks = function (searchRequest) {
|
|
8446
|
+
var _this = this;
|
|
8447
|
+
// Do not need to check if WA enabled as parent method will do that
|
|
8448
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/searchForCompletable";
|
|
8449
|
+
return this.http
|
|
8450
|
+
.post(url, { searchRequest: searchRequest }, null, false)
|
|
8451
|
+
.pipe(operators.map(function (response) { return response; }), operators.catchError(function (error) {
|
|
8452
|
+
_this.errorService.setError(error);
|
|
8453
|
+
// explicitly eat away 401 error and 400 error
|
|
8454
|
+
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
8455
|
+
// do nothing
|
|
8456
|
+
console.log('error status 401 or 400', error);
|
|
8457
|
+
}
|
|
8458
|
+
else {
|
|
8459
|
+
return rxjs.throwError(error);
|
|
8460
|
+
}
|
|
8461
|
+
}));
|
|
8462
|
+
};
|
|
8463
|
+
WorkAllocationService.prototype.isWAEnabled = function (jurisdiction, caseType) {
|
|
8464
|
+
this.features = this.appConfig.getWAServiceConfig();
|
|
8465
|
+
var enabled = false;
|
|
8466
|
+
if (!jurisdiction || !caseType) {
|
|
8467
|
+
var caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
8468
|
+
jurisdiction = caseInfo.jurisdiction;
|
|
8469
|
+
caseType = caseInfo.caseType;
|
|
8470
|
+
}
|
|
8471
|
+
if (!this.features || !this.features.configurations) {
|
|
8472
|
+
return false;
|
|
8473
|
+
}
|
|
8474
|
+
this.features.configurations.forEach(function (serviceConfig) {
|
|
8475
|
+
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
8476
|
+
enabled = true;
|
|
8477
|
+
}
|
|
8478
|
+
});
|
|
8479
|
+
return enabled;
|
|
8480
|
+
};
|
|
8481
|
+
/**
|
|
8482
|
+
* Call the API to assign a task.
|
|
8483
|
+
* @param taskId specifies which task should be assigned.
|
|
8484
|
+
* @param userId specifies the user the task should be assigned to.
|
|
8485
|
+
*/
|
|
8486
|
+
WorkAllocationService.prototype.assignTask = function (taskId, userId) {
|
|
8487
|
+
var _this = this;
|
|
8488
|
+
if (!this.isWAEnabled()) {
|
|
8489
|
+
return rxjs.of(null);
|
|
8490
|
+
}
|
|
8491
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/assign";
|
|
8492
|
+
return this.http
|
|
8493
|
+
.post(url, { userId: userId })
|
|
8494
|
+
.pipe(operators.catchError(function (error) {
|
|
8495
|
+
_this.errorService.setError(error);
|
|
8496
|
+
return rxjs.throwError(error);
|
|
8497
|
+
}));
|
|
8498
|
+
};
|
|
8499
|
+
/**
|
|
8500
|
+
* Call the API to complete a task.
|
|
8501
|
+
* @param taskId specifies which task should be completed.
|
|
8502
|
+
*/
|
|
8503
|
+
WorkAllocationService.prototype.completeTask = function (taskId) {
|
|
8504
|
+
var _this = this;
|
|
8505
|
+
if (!this.isWAEnabled()) {
|
|
8506
|
+
return rxjs.of(null);
|
|
8507
|
+
}
|
|
8508
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
8509
|
+
return this.http
|
|
8510
|
+
.post(url, {})
|
|
8511
|
+
.pipe(operators.catchError(function (error) {
|
|
8512
|
+
_this.errorService.setError(error);
|
|
8513
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
8514
|
+
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
8515
|
+
_this.handleTaskCompletionError(response);
|
|
8516
|
+
});
|
|
8517
|
+
return rxjs.throwError(error);
|
|
8518
|
+
}));
|
|
8519
|
+
};
|
|
8520
|
+
/**
|
|
8521
|
+
* Call the API to assign and complete a task.
|
|
8522
|
+
* @param taskId specifies which task should be completed.
|
|
8523
|
+
*/
|
|
8524
|
+
WorkAllocationService.prototype.assignAndCompleteTask = function (taskId) {
|
|
8525
|
+
var _this = this;
|
|
8526
|
+
if (!this.isWAEnabled()) {
|
|
8527
|
+
return rxjs.of(null);
|
|
8528
|
+
}
|
|
8529
|
+
var url = this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId + "/complete";
|
|
8530
|
+
return this.http
|
|
8531
|
+
.post(url, {
|
|
8532
|
+
completion_options: {
|
|
8533
|
+
assign_and_complete: true
|
|
8534
|
+
}
|
|
8535
|
+
})
|
|
8536
|
+
.pipe(operators.catchError(function (error) {
|
|
8537
|
+
_this.errorService.setError(error);
|
|
8538
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
8539
|
+
_this.http.get(_this.appConfig.getUserInfoApiUrl()).pipe(operators.map(function (response) { return response; })).subscribe(function (response) {
|
|
8540
|
+
_this.handleTaskCompletionError(response);
|
|
8541
|
+
});
|
|
8542
|
+
return rxjs.throwError(error);
|
|
8543
|
+
}));
|
|
8544
|
+
};
|
|
8545
|
+
/**
|
|
8546
|
+
* Handles the response from the observable to get the user details when task is completed.
|
|
8547
|
+
* @param response is the response given from the observable which contains the user detaild.
|
|
8548
|
+
*/
|
|
8549
|
+
WorkAllocationService.prototype.handleTaskCompletionError = function (response) {
|
|
8550
|
+
var userDetails = response;
|
|
8551
|
+
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
8552
|
+
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
8553
|
+
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
8554
|
+
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
8555
|
+
}
|
|
8556
|
+
};
|
|
8557
|
+
/**
|
|
8558
|
+
* Returns true if the user's role is equivalent to a caseworker.
|
|
8559
|
+
* @param roles is the list of roles found from the current user.
|
|
8560
|
+
*/
|
|
8561
|
+
WorkAllocationService.prototype.userIsCaseworker = function (roles) {
|
|
8562
|
+
var lowerCaseRoles = roles.map(function (role) { return role.toLowerCase(); });
|
|
8563
|
+
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
8564
|
+
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
8565
|
+
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
8566
|
+
};
|
|
8567
|
+
/**
|
|
8568
|
+
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
8569
|
+
* 1. No tasks found => Success.
|
|
8570
|
+
* 2. One task found => Mark as done => Success.
|
|
8571
|
+
* 3. One task found => Mark as done throws error => Failure.
|
|
8572
|
+
* 4. More than one task found => Failure.
|
|
8573
|
+
* 5. Search call throws an error => Failure.
|
|
8574
|
+
* @param ccdId The ID of the case to find tasks for.
|
|
8575
|
+
* @param eventId The ID of the event to find tasks for.
|
|
8576
|
+
*/
|
|
8577
|
+
WorkAllocationService.prototype.completeAppropriateTask = function (ccdId, eventId, jurisdiction, caseTypeId) {
|
|
8578
|
+
var _this = this;
|
|
8579
|
+
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
8580
|
+
return rxjs.of(null);
|
|
8581
|
+
}
|
|
8582
|
+
var taskSearchParameter = {
|
|
8583
|
+
ccdId: ccdId,
|
|
8584
|
+
eventId: eventId,
|
|
8585
|
+
jurisdiction: jurisdiction,
|
|
8586
|
+
caseTypeId: caseTypeId
|
|
8587
|
+
};
|
|
8588
|
+
return this.searchTasks(taskSearchParameter)
|
|
8589
|
+
.pipe(operators.map(function (response) {
|
|
8590
|
+
var tasks = response.tasks;
|
|
8591
|
+
if (tasks && tasks.length > 0) {
|
|
8592
|
+
if (tasks.length === 1) {
|
|
8593
|
+
_this.completeTask(tasks[0].id).subscribe();
|
|
8594
|
+
}
|
|
8595
|
+
else {
|
|
8596
|
+
// This is a problem. Throw an appropriate error.
|
|
8597
|
+
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
8598
|
+
}
|
|
8599
|
+
}
|
|
8600
|
+
return true; // All good. Nothing to see here.
|
|
8601
|
+
}), operators.catchError(function (error) {
|
|
8602
|
+
// Simply rethrow it.
|
|
8603
|
+
return rxjs.throwError(error);
|
|
8604
|
+
}));
|
|
8605
|
+
};
|
|
8606
|
+
/**
|
|
8607
|
+
* Return tasks for case and event.
|
|
8608
|
+
*/
|
|
8609
|
+
WorkAllocationService.prototype.getTasksByCaseIdAndEventId = function (eventId, caseId, caseType, jurisdiction) {
|
|
8610
|
+
var defaultPayload = {
|
|
8611
|
+
task_required_for_event: false,
|
|
8612
|
+
tasks: []
|
|
8613
|
+
};
|
|
8614
|
+
if (!this.isWAEnabled()) {
|
|
8615
|
+
return rxjs.of(defaultPayload);
|
|
8616
|
+
}
|
|
8617
|
+
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/case/tasks/" + caseId + "/event/" + eventId + "/caseType/" + caseType + "/jurisdiction/" + jurisdiction);
|
|
8618
|
+
};
|
|
8619
|
+
/**
|
|
8620
|
+
* Call the API to get a task
|
|
8621
|
+
*/
|
|
8622
|
+
WorkAllocationService.prototype.getTask = function (taskId) {
|
|
8623
|
+
if (!this.isWAEnabled()) {
|
|
8624
|
+
return rxjs.of({ task: null });
|
|
8625
|
+
}
|
|
8626
|
+
return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/task/" + taskId);
|
|
8627
|
+
};
|
|
8628
|
+
return WorkAllocationService;
|
|
8629
|
+
}());
|
|
8630
|
+
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
8631
|
+
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
8632
|
+
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)); };
|
|
8633
|
+
WorkAllocationService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
8634
|
+
(function () {
|
|
8635
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(WorkAllocationService, [{
|
|
8636
|
+
type: i0.Injectable
|
|
8637
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
|
|
8638
|
+
})();
|
|
8639
|
+
|
|
8424
8640
|
var CasesService = /** @class */ (function () {
|
|
8425
|
-
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService) {
|
|
8641
|
+
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, workAllocationService, loadingService, sessionStorageService) {
|
|
8426
8642
|
this.http = http;
|
|
8427
8643
|
this.appConfig = appConfig;
|
|
8428
8644
|
this.orderService = orderService;
|
|
8429
8645
|
this.errorService = errorService;
|
|
8430
8646
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
8647
|
+
this.workAllocationService = workAllocationService;
|
|
8431
8648
|
this.loadingService = loadingService;
|
|
8432
8649
|
this.sessionStorageService = sessionStorageService;
|
|
8433
8650
|
this.get = this.getCaseView;
|
|
@@ -8662,12 +8879,12 @@
|
|
|
8662
8879
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
8663
8880
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
8664
8881
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
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)); };
|
|
8882
|
+
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(WorkAllocationService), i0__namespace.ɵɵinject(LoadingService), i0__namespace.ɵɵinject(SessionStorageService)); };
|
|
8666
8883
|
CasesService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8667
8884
|
(function () {
|
|
8668
8885
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CasesService, [{
|
|
8669
8886
|
type: i0.Injectable
|
|
8670
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }]; }, null);
|
|
8887
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: WorkAllocationService }, { type: LoadingService }, { type: SessionStorageService }]; }, null);
|
|
8671
8888
|
})();
|
|
8672
8889
|
|
|
8673
8890
|
var EventTriggerService = /** @class */ (function () {
|
|
@@ -9321,215 +9538,6 @@
|
|
|
9321
9538
|
}], function () { return [{ type: CaseFieldService }]; }, null);
|
|
9322
9539
|
})();
|
|
9323
9540
|
|
|
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
|
-
|
|
9533
9541
|
var CaseEditComponent = /** @class */ (function () {
|
|
9534
9542
|
function CaseEditComponent(fb, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService) {
|
|
9535
9543
|
this.fb = fb;
|
|
@@ -10032,14 +10040,14 @@
|
|
|
10032
10040
|
this.title$ = new rxjs.BehaviorSubject(null);
|
|
10033
10041
|
this.formValidationErrors$ = new rxjs.BehaviorSubject([]);
|
|
10034
10042
|
this.editForm$ = new rxjs.BehaviorSubject(null);
|
|
10035
|
-
this.
|
|
10043
|
+
this.isLinkedCasesJourneyAtFinalStep$ = new rxjs.BehaviorSubject(null);
|
|
10036
10044
|
this.eventTriggerName$ = new rxjs.BehaviorSubject(null);
|
|
10037
10045
|
this.triggerSubmitEvent$ = new rxjs.BehaviorSubject(null);
|
|
10038
10046
|
this.caseDetails$ = this.details$.asObservable();
|
|
10039
10047
|
this.caseTitle$ = this.title$.asObservable();
|
|
10040
10048
|
this.caseEditForm$ = this.editForm$.asObservable();
|
|
10041
10049
|
this.caseFormValidationErrors$ = this.formValidationErrors$.asObservable();
|
|
10042
|
-
this.
|
|
10050
|
+
this.caseIsLinkedCasesJourneyAtFinalStep$ = this.isLinkedCasesJourneyAtFinalStep$.asObservable();
|
|
10043
10051
|
this.caseEventTriggerName$ = this.eventTriggerName$.asObservable();
|
|
10044
10052
|
this.caseTriggerSubmitEvent$ = this.triggerSubmitEvent$.asObservable();
|
|
10045
10053
|
}
|
|
@@ -10052,9 +10060,6 @@
|
|
|
10052
10060
|
CaseEditDataService.prototype.setCaseEventTriggerName = function (triggerName) {
|
|
10053
10061
|
this.eventTriggerName$.next(triggerName);
|
|
10054
10062
|
};
|
|
10055
|
-
CaseEditDataService.prototype.setCaseLinkError = function (error) {
|
|
10056
|
-
this.linkError$.next(error);
|
|
10057
|
-
};
|
|
10058
10063
|
CaseEditDataService.prototype.setFormValidationErrors = function (validationErrors) {
|
|
10059
10064
|
this.formValidationErrors$.next(validationErrors);
|
|
10060
10065
|
};
|
|
@@ -10064,8 +10069,8 @@
|
|
|
10064
10069
|
CaseEditDataService.prototype.clearFormValidationErrors = function () {
|
|
10065
10070
|
this.formValidationErrors$.next([]);
|
|
10066
10071
|
};
|
|
10067
|
-
CaseEditDataService.prototype.
|
|
10068
|
-
this.
|
|
10072
|
+
CaseEditDataService.prototype.setLinkedCasesJourneyAtFinalStep = function (isAtFinalStep) {
|
|
10073
|
+
this.isLinkedCasesJourneyAtFinalStep$.next(isAtFinalStep);
|
|
10069
10074
|
};
|
|
10070
10075
|
CaseEditDataService.prototype.addFormValidationError = function (validationError) {
|
|
10071
10076
|
this.formValidationErrors$.next(this.formValidationErrors$.getValue().concat([validationError]));
|
|
@@ -10422,6 +10427,11 @@
|
|
|
10422
10427
|
this.caseEditDataService.caseEditForm$.subscribe({
|
|
10423
10428
|
next: function (editForm) { return _this.editForm = editForm; }
|
|
10424
10429
|
});
|
|
10430
|
+
this.caseEditDataService.caseIsLinkedCasesJourneyAtFinalStep$.subscribe({
|
|
10431
|
+
next: function (isLinkedCasesJourneyAtFinalStep) {
|
|
10432
|
+
_this.isLinkedCasesJourneyAtFinalStep = isLinkedCasesJourneyAtFinalStep;
|
|
10433
|
+
}
|
|
10434
|
+
});
|
|
10425
10435
|
this.caseEditDataService.caseTriggerSubmitEvent$.subscribe({
|
|
10426
10436
|
next: function (state) {
|
|
10427
10437
|
if (state) {
|
|
@@ -10441,7 +10451,11 @@
|
|
|
10441
10451
|
return this.caseEdit.first();
|
|
10442
10452
|
};
|
|
10443
10453
|
CaseEditPageComponent.prototype.currentPageIsNotValid = function () {
|
|
10444
|
-
return !this.pageValidationService.isPageValid(this.currentPage, this.editForm)
|
|
10454
|
+
return !this.pageValidationService.isPageValid(this.currentPage, this.editForm) ||
|
|
10455
|
+
(this.isLinkedCasesJourney() && !this.isLinkedCasesJourneyAtFinalStep);
|
|
10456
|
+
};
|
|
10457
|
+
CaseEditPageComponent.prototype.isLinkedCasesJourney = function () {
|
|
10458
|
+
return FieldsUtils.containsLinkedCasesCaseField(this.currentPage.case_fields);
|
|
10445
10459
|
};
|
|
10446
10460
|
/**
|
|
10447
10461
|
* caseEventData.event_data contains all the values from the previous pages so we set caseEventData.data = caseEventData.event_data
|
|
@@ -10541,7 +10555,16 @@
|
|
|
10541
10555
|
var _this = this;
|
|
10542
10556
|
this.caseEditDataService.clearFormValidationErrors();
|
|
10543
10557
|
if (this.currentPageIsNotValid()) {
|
|
10544
|
-
|
|
10558
|
+
// The generateErrorMessage method filters out the hidden fields.
|
|
10559
|
+
// The error message for LinkedCases journey will never get displayed because the
|
|
10560
|
+
// LinkedCases is configured with ComponentLauncher field as visible and caseLinks field as hidden.
|
|
10561
|
+
if (this.isLinkedCasesJourney()) {
|
|
10562
|
+
this.validationErrors.push({ id: 'next-button', message: 'Please select Next to go to the next page' });
|
|
10563
|
+
CaseEditPageComponent.scrollToTop();
|
|
10564
|
+
}
|
|
10565
|
+
else {
|
|
10566
|
+
this.generateErrorMessage(this.currentPage.case_fields);
|
|
10567
|
+
}
|
|
10545
10568
|
}
|
|
10546
10569
|
if (!this.isSubmitting && !this.currentPageIsNotValid()) {
|
|
10547
10570
|
this.isSubmitting = true;
|
|
@@ -17597,87 +17620,52 @@
|
|
|
17597
17620
|
}], function () { return [{ type: i1__namespace$1.ActivatedRoute }, { type: i1__namespace$1.Router }, { type: LinkedCasesService }, { type: AbstractAppConfig }, { type: CommonDataService }]; }, null);
|
|
17598
17621
|
})();
|
|
17599
17622
|
|
|
17600
|
-
function
|
|
17601
|
-
if (rf & 1) {
|
|
17602
|
-
var _r9_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17603
|
-
i0__namespace.ɵɵelementStart(0, "div", 7);
|
|
17604
|
-
i0__namespace.ɵɵelementStart(1, "ul", 8);
|
|
17605
|
-
i0__namespace.ɵɵelementStart(2, "li");
|
|
17606
|
-
i0__namespace.ɵɵelementStart(3, "a", 9);
|
|
17607
|
-
i0__namespace.ɵɵlistener("click", function WriteLinkedCasesFieldComponent_div_0_div_3_Template_a_click_3_listener() { i0__namespace.ɵɵrestoreView(_r9_1); var errorMessage_r7 = ctx.$implicit; var ctx_r8 = i0__namespace.ɵɵnextContext(2); return ctx_r8.navigateToErrorElement(errorMessage_r7.fieldId); });
|
|
17608
|
-
i0__namespace.ɵɵtext(4);
|
|
17609
|
-
i0__namespace.ɵɵelementEnd();
|
|
17610
|
-
i0__namespace.ɵɵelementEnd();
|
|
17611
|
-
i0__namespace.ɵɵelementEnd();
|
|
17612
|
-
i0__namespace.ɵɵelementEnd();
|
|
17613
|
-
}
|
|
17614
|
-
if (rf & 2) {
|
|
17615
|
-
var errorMessage_r7 = ctx.$implicit;
|
|
17616
|
-
i0__namespace.ɵɵadvance(4);
|
|
17617
|
-
i0__namespace.ɵɵtextInterpolate(errorMessage_r7.description);
|
|
17618
|
-
}
|
|
17619
|
-
}
|
|
17620
|
-
function WriteLinkedCasesFieldComponent_div_0_Template(rf, ctx) {
|
|
17623
|
+
function WriteLinkedCasesFieldComponent_ng_container_2_Template(rf, ctx) {
|
|
17621
17624
|
if (rf & 1) {
|
|
17622
|
-
i0__namespace.ɵɵ
|
|
17623
|
-
i0__namespace.ɵɵ
|
|
17624
|
-
i0__namespace.ɵɵ
|
|
17625
|
-
i0__namespace.ɵɵ
|
|
17626
|
-
i0__namespace.ɵɵtemplate(3, WriteLinkedCasesFieldComponent_div_0_div_3_Template, 5, 1, "div", 6);
|
|
17625
|
+
var _r6_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17626
|
+
i0__namespace.ɵɵelementContainerStart(0);
|
|
17627
|
+
i0__namespace.ɵɵelementStart(1, "ccd-linked-cases-before-you-start", 3);
|
|
17628
|
+
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_2_Template_ccd_linked_cases_before_you_start_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r6_1); var ctx_r5 = i0__namespace.ɵɵnextContext(); return ctx_r5.onLinkedCasesStateEmitted($event); });
|
|
17627
17629
|
i0__namespace.ɵɵelementEnd();
|
|
17628
|
-
|
|
17629
|
-
if (rf & 2) {
|
|
17630
|
-
var ctx_r0 = i0__namespace.ɵɵnextContext();
|
|
17631
|
-
i0__namespace.ɵɵadvance(3);
|
|
17632
|
-
i0__namespace.ɵɵproperty("ngForOf", ctx_r0.errorMessages);
|
|
17630
|
+
i0__namespace.ɵɵelementContainerEnd();
|
|
17633
17631
|
}
|
|
17634
17632
|
}
|
|
17635
17633
|
function WriteLinkedCasesFieldComponent_ng_container_3_Template(rf, ctx) {
|
|
17636
17634
|
if (rf & 1) {
|
|
17637
|
-
var
|
|
17635
|
+
var _r8_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17638
17636
|
i0__namespace.ɵɵelementContainerStart(0);
|
|
17639
|
-
i0__namespace.ɵɵelementStart(1, "ccd-linked-cases
|
|
17640
|
-
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function
|
|
17637
|
+
i0__namespace.ɵɵelementStart(1, "ccd-no-linked-cases", 3);
|
|
17638
|
+
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_3_Template_ccd_no_linked_cases_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r8_1); var ctx_r7 = i0__namespace.ɵɵnextContext(); return ctx_r7.onLinkedCasesStateEmitted($event); });
|
|
17641
17639
|
i0__namespace.ɵɵelementEnd();
|
|
17642
17640
|
i0__namespace.ɵɵelementContainerEnd();
|
|
17643
17641
|
}
|
|
17644
17642
|
}
|
|
17645
17643
|
function WriteLinkedCasesFieldComponent_ng_container_4_Template(rf, ctx) {
|
|
17646
17644
|
if (rf & 1) {
|
|
17647
|
-
var
|
|
17645
|
+
var _r10_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17648
17646
|
i0__namespace.ɵɵelementContainerStart(0);
|
|
17649
|
-
i0__namespace.ɵɵelementStart(1, "ccd-
|
|
17650
|
-
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function
|
|
17647
|
+
i0__namespace.ɵɵelementStart(1, "ccd-link-cases", 3);
|
|
17648
|
+
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_4_Template_ccd_link_cases_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r10_1); var ctx_r9 = i0__namespace.ɵɵnextContext(); return ctx_r9.onLinkedCasesStateEmitted($event); });
|
|
17651
17649
|
i0__namespace.ɵɵelementEnd();
|
|
17652
17650
|
i0__namespace.ɵɵelementContainerEnd();
|
|
17653
17651
|
}
|
|
17654
17652
|
}
|
|
17655
17653
|
function WriteLinkedCasesFieldComponent_ng_container_5_Template(rf, ctx) {
|
|
17656
17654
|
if (rf & 1) {
|
|
17657
|
-
var
|
|
17655
|
+
var _r12_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17658
17656
|
i0__namespace.ɵɵelementContainerStart(0);
|
|
17659
|
-
i0__namespace.ɵɵelementStart(1, "ccd-
|
|
17660
|
-
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function
|
|
17657
|
+
i0__namespace.ɵɵelementStart(1, "ccd-unlink-cases", 3);
|
|
17658
|
+
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_5_Template_ccd_unlink_cases_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r12_1); var ctx_r11 = i0__namespace.ɵɵnextContext(); return ctx_r11.onLinkedCasesStateEmitted($event); });
|
|
17661
17659
|
i0__namespace.ɵɵelementEnd();
|
|
17662
17660
|
i0__namespace.ɵɵelementContainerEnd();
|
|
17663
17661
|
}
|
|
17664
17662
|
}
|
|
17665
17663
|
function WriteLinkedCasesFieldComponent_ng_container_6_Template(rf, ctx) {
|
|
17666
17664
|
if (rf & 1) {
|
|
17667
|
-
var
|
|
17668
|
-
i0__namespace.ɵɵelementContainerStart(0);
|
|
17669
|
-
i0__namespace.ɵɵelementStart(1, "ccd-unlink-cases", 10);
|
|
17670
|
-
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_6_Template_ccd_unlink_cases_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r17_1); var ctx_r16 = i0__namespace.ɵɵnextContext(); return ctx_r16.onLinkedCasesStateEmitted($event); });
|
|
17671
|
-
i0__namespace.ɵɵelementEnd();
|
|
17672
|
-
i0__namespace.ɵɵelementContainerEnd();
|
|
17673
|
-
}
|
|
17674
|
-
}
|
|
17675
|
-
function WriteLinkedCasesFieldComponent_ng_container_7_Template(rf, ctx) {
|
|
17676
|
-
if (rf & 1) {
|
|
17677
|
-
var _r19_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17665
|
+
var _r14_1 = i0__namespace.ɵɵgetCurrentView();
|
|
17678
17666
|
i0__namespace.ɵɵelementContainerStart(0);
|
|
17679
|
-
i0__namespace.ɵɵelementStart(1, "ccd-linked-cases-check-your-answers",
|
|
17680
|
-
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function
|
|
17667
|
+
i0__namespace.ɵɵelementStart(1, "ccd-linked-cases-check-your-answers", 3);
|
|
17668
|
+
i0__namespace.ɵɵlistener("linkedCasesStateEmitter", function WriteLinkedCasesFieldComponent_ng_container_6_Template_ccd_linked_cases_check_your_answers_linkedCasesStateEmitter_1_listener($event) { i0__namespace.ɵɵrestoreView(_r14_1); var ctx_r13 = i0__namespace.ɵɵnextContext(); return ctx_r13.onLinkedCasesStateEmitted($event); });
|
|
17681
17669
|
i0__namespace.ɵɵelementEnd();
|
|
17682
17670
|
i0__namespace.ɵɵelementContainerEnd();
|
|
17683
17671
|
}
|
|
@@ -17694,11 +17682,13 @@
|
|
|
17694
17682
|
_this.linkedCasesPages = exports.LinkedCasesPages;
|
|
17695
17683
|
_this.linkedCasesEventTriggers = exports.LinkedCasesEventTriggers;
|
|
17696
17684
|
_this.linkedCases = [];
|
|
17697
|
-
_this.errorMessages = [];
|
|
17698
17685
|
return _this;
|
|
17699
17686
|
}
|
|
17700
17687
|
WriteLinkedCasesFieldComponent.prototype.ngOnInit = function () {
|
|
17701
17688
|
var _this = this;
|
|
17689
|
+
// This is required to enable Continue button validation
|
|
17690
|
+
// Continue button should be enabled only at check your answers page
|
|
17691
|
+
this.caseEditDataService.setLinkedCasesJourneyAtFinalStep(false);
|
|
17702
17692
|
// Clear validation errors
|
|
17703
17693
|
this.caseEditDataService.clearFormValidationErrors();
|
|
17704
17694
|
// Get linked case reasons from ref data
|
|
@@ -17735,11 +17725,10 @@
|
|
|
17735
17725
|
};
|
|
17736
17726
|
WriteLinkedCasesFieldComponent.prototype.onLinkedCasesStateEmitted = function (linkedCasesState) {
|
|
17737
17727
|
var _this = this;
|
|
17738
|
-
|
|
17728
|
+
// Clear validation errors
|
|
17739
17729
|
this.caseEditDataService.clearFormValidationErrors();
|
|
17740
17730
|
if (linkedCasesState.navigateToNextPage) {
|
|
17741
17731
|
this.linkedCasesPage = this.getNextPage(linkedCasesState);
|
|
17742
|
-
this.setContinueButtonValidationErrorMessage();
|
|
17743
17732
|
this.proceedToNextPage();
|
|
17744
17733
|
}
|
|
17745
17734
|
else {
|
|
@@ -17763,27 +17752,19 @@
|
|
|
17763
17752
|
}
|
|
17764
17753
|
});
|
|
17765
17754
|
};
|
|
17766
|
-
WriteLinkedCasesFieldComponent.prototype.setContinueButtonValidationErrorMessage = function () {
|
|
17767
|
-
var errorMessage = this.linkedCasesService.isLinkedCasesEventTrigger
|
|
17768
|
-
? exports.LinkedCasesErrorMessages.LinkCasesNavigationError
|
|
17769
|
-
: exports.LinkedCasesErrorMessages.UnlinkCasesNavigationError;
|
|
17770
|
-
var buttonId = this.linkedCasesService.linkedCases.length === 0
|
|
17771
|
-
? 'back-button'
|
|
17772
|
-
: 'next-button';
|
|
17773
|
-
this.caseEditDataService.setCaseLinkError({
|
|
17774
|
-
componentId: buttonId,
|
|
17775
|
-
errorMessage: errorMessage
|
|
17776
|
-
});
|
|
17777
|
-
};
|
|
17778
17755
|
WriteLinkedCasesFieldComponent.prototype.proceedToNextPage = function () {
|
|
17779
17756
|
if (this.isAtFinalPage()) {
|
|
17780
17757
|
// Continue button event must be allowed in final page
|
|
17781
|
-
this.caseEditDataService.
|
|
17758
|
+
this.caseEditDataService.setLinkedCasesJourneyAtFinalStep(true);
|
|
17782
17759
|
// Trigger validation to clear the "notAtFinalPage" error if now at the final state
|
|
17783
17760
|
this.formGroup.updateValueAndValidity();
|
|
17784
17761
|
// update form value
|
|
17785
17762
|
this.submitLinkedCases();
|
|
17786
17763
|
}
|
|
17764
|
+
else {
|
|
17765
|
+
// Continue button event must not be allowed if not in final page
|
|
17766
|
+
this.caseEditDataService.setLinkedCasesJourneyAtFinalStep(false);
|
|
17767
|
+
}
|
|
17787
17768
|
};
|
|
17788
17769
|
WriteLinkedCasesFieldComponent.prototype.submitLinkedCases = function () {
|
|
17789
17770
|
if (!this.linkedCasesService.isLinkedCasesEventTrigger) {
|
|
@@ -17828,38 +17809,24 @@
|
|
|
17828
17809
|
&& !_this.linkedCasesService.serverLinkedApiError)
|
|
17829
17810
|
? exports.LinkedCasesPages.BEFORE_YOU_START
|
|
17830
17811
|
: exports.LinkedCasesPages.NO_LINKED_CASES;
|
|
17831
|
-
// Initialise the error to be displayed when clicked on Continue button
|
|
17832
|
-
_this.setContinueButtonValidationErrorMessage();
|
|
17833
17812
|
});
|
|
17834
17813
|
};
|
|
17835
|
-
WriteLinkedCasesFieldComponent.prototype.navigateToErrorElement = function (elementId) {
|
|
17836
|
-
if (elementId) {
|
|
17837
|
-
var htmlElement = document.getElementById(elementId);
|
|
17838
|
-
if (htmlElement) {
|
|
17839
|
-
htmlElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
17840
|
-
htmlElement.focus();
|
|
17841
|
-
}
|
|
17842
|
-
}
|
|
17843
|
-
};
|
|
17844
17814
|
return WriteLinkedCasesFieldComponent;
|
|
17845
17815
|
}(AbstractFieldWriteComponent));
|
|
17846
17816
|
WriteLinkedCasesFieldComponent.ɵfac = function WriteLinkedCasesFieldComponent_Factory(t) { return new (t || WriteLinkedCasesFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CommonDataService), i0__namespace.ɵɵdirectiveInject(CasesService), i0__namespace.ɵɵdirectiveInject(LinkedCasesService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
|
|
17847
|
-
WriteLinkedCasesFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteLinkedCasesFieldComponent, selectors: [["ccd-write-linked-cases-field"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls:
|
|
17817
|
+
WriteLinkedCasesFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteLinkedCasesFieldComponent, selectors: [["ccd-write-linked-cases-field"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 7, vars: 7, consts: [[1, "form-group", "govuk-!-margin-bottom-2", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], [4, "ngSwitchCase"], [3, "linkedCasesStateEmitter"]], template: function WriteLinkedCasesFieldComponent_Template(rf, ctx) {
|
|
17848
17818
|
if (rf & 1) {
|
|
17849
|
-
i0__namespace.ɵɵ
|
|
17819
|
+
i0__namespace.ɵɵelementStart(0, "div", 0);
|
|
17850
17820
|
i0__namespace.ɵɵelementStart(1, "div", 1);
|
|
17851
|
-
i0__namespace.ɵɵ
|
|
17852
|
-
i0__namespace.ɵɵtemplate(3, WriteLinkedCasesFieldComponent_ng_container_3_Template, 2, 0, "ng-container",
|
|
17853
|
-
i0__namespace.ɵɵtemplate(4, WriteLinkedCasesFieldComponent_ng_container_4_Template, 2, 0, "ng-container",
|
|
17854
|
-
i0__namespace.ɵɵtemplate(5, WriteLinkedCasesFieldComponent_ng_container_5_Template, 2, 0, "ng-container",
|
|
17855
|
-
i0__namespace.ɵɵtemplate(6, WriteLinkedCasesFieldComponent_ng_container_6_Template, 2, 0, "ng-container",
|
|
17856
|
-
i0__namespace.ɵɵtemplate(7, WriteLinkedCasesFieldComponent_ng_container_7_Template, 2, 0, "ng-container", 3);
|
|
17821
|
+
i0__namespace.ɵɵtemplate(2, WriteLinkedCasesFieldComponent_ng_container_2_Template, 2, 0, "ng-container", 2);
|
|
17822
|
+
i0__namespace.ɵɵtemplate(3, WriteLinkedCasesFieldComponent_ng_container_3_Template, 2, 0, "ng-container", 2);
|
|
17823
|
+
i0__namespace.ɵɵtemplate(4, WriteLinkedCasesFieldComponent_ng_container_4_Template, 2, 0, "ng-container", 2);
|
|
17824
|
+
i0__namespace.ɵɵtemplate(5, WriteLinkedCasesFieldComponent_ng_container_5_Template, 2, 0, "ng-container", 2);
|
|
17825
|
+
i0__namespace.ɵɵtemplate(6, WriteLinkedCasesFieldComponent_ng_container_6_Template, 2, 0, "ng-container", 2);
|
|
17857
17826
|
i0__namespace.ɵɵelementEnd();
|
|
17858
17827
|
i0__namespace.ɵɵelementEnd();
|
|
17859
17828
|
}
|
|
17860
17829
|
if (rf & 2) {
|
|
17861
|
-
i0__namespace.ɵɵproperty("ngIf", ctx.errorMessages.length > 0);
|
|
17862
|
-
i0__namespace.ɵɵadvance(1);
|
|
17863
17830
|
i0__namespace.ɵɵproperty("formGroup", ctx.formGroup);
|
|
17864
17831
|
i0__namespace.ɵɵadvance(1);
|
|
17865
17832
|
i0__namespace.ɵɵproperty("ngSwitch", ctx.linkedCasesPage);
|
|
@@ -26056,7 +26023,7 @@
|
|
|
26056
26023
|
AddCommentsComponent,
|
|
26057
26024
|
ManageCaseFlagsComponent,
|
|
26058
26025
|
UpdateFlagComponent], []);
|
|
26059
|
-
i0__namespace.ɵɵsetComponentScope(WriteLinkedCasesFieldComponent, [
|
|
26026
|
+
i0__namespace.ɵɵsetComponentScope(WriteLinkedCasesFieldComponent, [i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective, i1__namespace.NgSwitch, i1__namespace.NgSwitchCase, BeforeYouStartComponent,
|
|
26060
26027
|
NoLinkedCasesComponent,
|
|
26061
26028
|
LinkCasesComponent,
|
|
26062
26029
|
UnLinkCasesComponent,
|