@hmcts/ccd-case-ui-toolkit 6.16.2-ccpay-5.2.8 → 6.18.0-restricted-case-access
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 +233 -112
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +12 -14
- package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +24 -12
- package/esm2015/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.js +19 -17
- package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +10 -6
- package/esm2015/lib/shared/services/fields/fields.utils.js +22 -1
- package/esm2015/lib/shared/services/form/form-value.service.js +37 -43
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +118 -87
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +12 -3
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.utils.d.ts +16 -0
- package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/lib/shared/services/form/form-value.service.d.ts +14 -13
- package/lib/shared/services/form/form-value.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3452,18 +3452,39 @@ class FieldsUtils {
|
|
|
3452
3452
|
}
|
|
3453
3453
|
return this.isFlagsFieldType(caseField.field_type);
|
|
3454
3454
|
}
|
|
3455
|
+
/**
|
|
3456
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'FlagLauncher' as the single type in the `types` array
|
|
3457
|
+
*/
|
|
3455
3458
|
static isFlagLauncherCaseField(caseField) {
|
|
3456
3459
|
if (!caseField) {
|
|
3457
3460
|
return false;
|
|
3458
3461
|
}
|
|
3459
3462
|
return caseField.field_type.type === 'FlagLauncher';
|
|
3460
3463
|
}
|
|
3464
|
+
/**
|
|
3465
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'ComponentLauncher' as the single type in the `types`
|
|
3466
|
+
* array
|
|
3467
|
+
*/
|
|
3461
3468
|
static isComponentLauncherCaseField(caseField) {
|
|
3462
3469
|
if (!caseField) {
|
|
3463
3470
|
return false;
|
|
3464
3471
|
}
|
|
3465
3472
|
return caseField.field_type.type === 'ComponentLauncher';
|
|
3466
3473
|
}
|
|
3474
|
+
/**
|
|
3475
|
+
* Checks if a {@link CaseField} is of one of the given field types.
|
|
3476
|
+
*
|
|
3477
|
+
* @param caseField The `CaseField` to check
|
|
3478
|
+
* @param types An array of one or more field types
|
|
3479
|
+
* @returns `true` if the `CaseField` type is one of those in the array of types to check against; `false`
|
|
3480
|
+
* otherwise or if `caseField` or `types` are falsy
|
|
3481
|
+
*/
|
|
3482
|
+
static isCaseFieldOfType(caseField, types) {
|
|
3483
|
+
if (!caseField || !types) {
|
|
3484
|
+
return false;
|
|
3485
|
+
}
|
|
3486
|
+
return types.some(type => type === caseField.field_type.type);
|
|
3487
|
+
}
|
|
3467
3488
|
static isLinkedCasesCaseField(caseField) {
|
|
3468
3489
|
return FieldsUtils.isComponentLauncherCaseField(caseField) &&
|
|
3469
3490
|
caseField.id === 'LinkedCasesComponentLauncher';
|
|
@@ -5504,65 +5525,59 @@ class FormValueService {
|
|
|
5504
5525
|
}
|
|
5505
5526
|
}
|
|
5506
5527
|
/**
|
|
5507
|
-
* Remove the
|
|
5528
|
+
* Remove from the top level of the form data any case fields of a given type or types that are not intended to be
|
|
5529
|
+
* persisted. This function is intended to remove "special" case field types from the data, such as FlagLauncher or
|
|
5530
|
+
* ComponentLauncher fields.
|
|
5508
5531
|
*
|
|
5509
|
-
* @param data The object tree of form values on which to perform the removal
|
|
5532
|
+
* @param data The object tree of form values on which to perform the removal at the top level only
|
|
5510
5533
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
5534
|
+
* @param types An array of one or more field types
|
|
5511
5535
|
*/
|
|
5512
|
-
|
|
5513
|
-
if (data && caseFields && caseFields.length > 0) {
|
|
5514
|
-
const
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
delete data[flagLauncherCaseField[0].id];
|
|
5536
|
+
removeCaseFieldsOfType(data, caseFields, types) {
|
|
5537
|
+
if (data && caseFields && caseFields.length > 0 && types.length > 0) {
|
|
5538
|
+
const caseFieldsToRemove = caseFields.filter(caseField => FieldsUtils.isCaseFieldOfType(caseField, types));
|
|
5539
|
+
for (const caseField of caseFieldsToRemove) {
|
|
5540
|
+
delete data[caseField.id];
|
|
5518
5541
|
}
|
|
5519
5542
|
}
|
|
5520
5543
|
}
|
|
5521
5544
|
/**
|
|
5522
|
-
*
|
|
5545
|
+
* Re-populate the form data from the values held in the case fields. This is necessary in order to pick up, for
|
|
5546
|
+
* each `Flags` field, any flag details data not currently present.
|
|
5547
|
+
*
|
|
5548
|
+
* `Flags` fields may be contained in other `CaseField` instances, either as a sub-field of a Complex field, or
|
|
5549
|
+
* fields in a collection (or sub-fields of Complex fields in a collection). Therefore, it is necessary to
|
|
5550
|
+
* iterate through all `CaseField`s.
|
|
5523
5551
|
*
|
|
5524
5552
|
* @param data The object tree of form values on which to perform the data population
|
|
5525
5553
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
5526
5554
|
*/
|
|
5527
|
-
|
|
5528
|
-
if (data && caseFields && caseFields.length > 0
|
|
5529
|
-
|
|
5530
|
-
//
|
|
5531
|
-
|
|
5532
|
-
caseFields.filter(caseField => !FieldsUtils.isFlagLauncherCaseField(caseField))
|
|
5555
|
+
repopulateFormDataFromCaseFieldValues(data, caseFields) {
|
|
5556
|
+
if (data && caseFields && caseFields.length > 0 &&
|
|
5557
|
+
caseFields.findIndex(caseField => FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher'])) > -1) {
|
|
5558
|
+
// Ignore the FlagLauncher CaseField because it does not hold any values
|
|
5559
|
+
caseFields.filter(caseField => !FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']))
|
|
5533
5560
|
.forEach(caseField => {
|
|
5534
|
-
// Ensure that the data object is populated for all
|
|
5535
|
-
//
|
|
5561
|
+
// Ensure that the data object is populated for all CaseField keys it contains, even if for a given
|
|
5562
|
+
// CaseField key, the data object has a falsy value (hence the use of hasOwnProperty() for the check below)
|
|
5563
|
+
// See https://tools.hmcts.net/jira/browse/EUI-7377
|
|
5536
5564
|
if (data.hasOwnProperty(caseField.id) && caseField.value) {
|
|
5537
|
-
// Create new object for the
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
Object.keys(data[caseField.id]).forEach(key => {
|
|
5542
|
-
if (caseField.value.hasOwnProperty(key)) {
|
|
5543
|
-
data[caseField.id][key] = caseField.value[key];
|
|
5544
|
-
}
|
|
5545
|
-
});
|
|
5565
|
+
// Create new object for the CaseField ID within the data object, if necessary (i.e. if the current value
|
|
5566
|
+
// is falsy)
|
|
5567
|
+
if (!data[caseField.id]) {
|
|
5568
|
+
data[caseField.id] = {};
|
|
5546
5569
|
}
|
|
5570
|
+
// Copy all values from the corresponding CaseField; this ensures all nested flag data (for example, a
|
|
5571
|
+
// Flags field within a Complex field or a collection of Complex fields) is copied across
|
|
5572
|
+
Object.keys(data[caseField.id]).forEach(key => {
|
|
5573
|
+
if (caseField.value.hasOwnProperty(key)) {
|
|
5574
|
+
data[caseField.id][key] = caseField.value[key];
|
|
5575
|
+
}
|
|
5576
|
+
});
|
|
5547
5577
|
}
|
|
5548
5578
|
});
|
|
5549
5579
|
}
|
|
5550
5580
|
}
|
|
5551
|
-
/**
|
|
5552
|
-
* Remove the ComponentLauncher case field, which is not intended to be persisted.
|
|
5553
|
-
*
|
|
5554
|
-
* @param data The object tree of form values on which to perform the removal
|
|
5555
|
-
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
5556
|
-
*/
|
|
5557
|
-
removeComponentLauncherField(data, caseFields) {
|
|
5558
|
-
if (data && caseFields && caseFields.length > 0) {
|
|
5559
|
-
const componentLauncherCaseField = caseFields.filter(caseField => FieldsUtils.isComponentLauncherCaseField(caseField));
|
|
5560
|
-
if (componentLauncherCaseField.length > 0) {
|
|
5561
|
-
// There should be only one ComponentLauncher case field
|
|
5562
|
-
delete data[componentLauncherCaseField[0].id];
|
|
5563
|
-
}
|
|
5564
|
-
}
|
|
5565
|
-
}
|
|
5566
5581
|
/**
|
|
5567
5582
|
* Populate the linked cases from the data held in its corresponding CaseField.
|
|
5568
5583
|
*
|
|
@@ -5571,7 +5586,7 @@ class FormValueService {
|
|
|
5571
5586
|
*/
|
|
5572
5587
|
populateLinkedCasesDetailsFromCaseFields(data, caseFields) {
|
|
5573
5588
|
if (data && caseFields && caseFields.length > 0) {
|
|
5574
|
-
caseFields.filter(caseField => !FieldsUtils.
|
|
5589
|
+
caseFields.filter(caseField => !FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']))
|
|
5575
5590
|
.forEach(caseField => {
|
|
5576
5591
|
if (data.hasOwnProperty('caseLinks') && caseField.value) {
|
|
5577
5592
|
data[caseField.id] = caseField.value;
|
|
@@ -8337,7 +8352,9 @@ class CaseEditComponent {
|
|
|
8337
8352
|
form: this.form,
|
|
8338
8353
|
});
|
|
8339
8354
|
/* istanbul ignore else */
|
|
8340
|
-
if (!nextPage &&
|
|
8355
|
+
if (!nextPage &&
|
|
8356
|
+
!(this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) &&
|
|
8357
|
+
!this.eventTrigger.show_event_notes) {
|
|
8341
8358
|
this.submitForm({
|
|
8342
8359
|
eventTrigger: this.eventTrigger,
|
|
8343
8360
|
form: this.form,
|
|
@@ -8426,16 +8443,13 @@ class CaseEditComponent {
|
|
|
8426
8443
|
// Remove collection fields that have "min" validation of greater than zero set on the FieldType but are empty;
|
|
8427
8444
|
// these will fail validation
|
|
8428
8445
|
this.formValueService.removeEmptyCollectionsWithMinValidation(caseEventData.data, eventTrigger.case_fields);
|
|
8429
|
-
//
|
|
8430
|
-
//
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
8437
|
-
this.formValueService.removeComponentLauncherField(caseEventData.data, eventTrigger.case_fields);
|
|
8438
|
-
}
|
|
8446
|
+
// For Case Flag submissions (where a FlagLauncher field is present in the event trigger), the flag details data
|
|
8447
|
+
// needs populating for each Flags field, then the FlagLauncher field needs removing
|
|
8448
|
+
this.formValueService.repopulateFormDataFromCaseFieldValues(caseEventData.data, eventTrigger.case_fields);
|
|
8449
|
+
// Data population step required for Linked Cases
|
|
8450
|
+
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
8451
|
+
// Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
|
|
8452
|
+
this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
|
|
8439
8453
|
caseEventData.event_token = eventTrigger.event_token;
|
|
8440
8454
|
caseEventData.ignore_warning = this.ignoreWarning;
|
|
8441
8455
|
if (this.confirmation) {
|
|
@@ -8554,8 +8568,7 @@ class CaseEditComponent {
|
|
|
8554
8568
|
this.sessionStorageService.removeItem('eventUrl');
|
|
8555
8569
|
const confirmation = this.buildConfirmation(response);
|
|
8556
8570
|
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
8557
|
-
|
|
8558
|
-
this.confirm(confirmation).finally();
|
|
8571
|
+
this.confirm(confirmation);
|
|
8559
8572
|
}
|
|
8560
8573
|
else {
|
|
8561
8574
|
this.emitSubmitted(response);
|
|
@@ -9214,7 +9227,7 @@ class CaseEditPageComponent {
|
|
|
9214
9227
|
this.wizard = this.caseEdit.wizard;
|
|
9215
9228
|
this.caseFields = this.getCaseFields();
|
|
9216
9229
|
this.syncCaseEditDataService();
|
|
9217
|
-
this.route.params
|
|
9230
|
+
this.routeParamsSub = this.route.params
|
|
9218
9231
|
.subscribe(params => {
|
|
9219
9232
|
var _a, _b;
|
|
9220
9233
|
const pageId = params['page'];
|
|
@@ -9236,13 +9249,14 @@ class CaseEditPageComponent {
|
|
|
9236
9249
|
}
|
|
9237
9250
|
});
|
|
9238
9251
|
CaseEditPageComponent.setFocusToTop();
|
|
9239
|
-
this.caseEditDataService.caseEditForm$.subscribe({
|
|
9252
|
+
this.caseEditFormSub = this.caseEditDataService.caseEditForm$.subscribe({
|
|
9240
9253
|
next: editForm => this.editForm = editForm
|
|
9241
9254
|
});
|
|
9242
|
-
this.
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9255
|
+
this.caseIsLinkedCasesJourneyAtFinalStepSub =
|
|
9256
|
+
this.caseEditDataService.caseIsLinkedCasesJourneyAtFinalStep$.subscribe({
|
|
9257
|
+
next: isLinkedCasesJourneyAtFinalStep => this.isLinkedCasesJourneyAtFinalStep = isLinkedCasesJourneyAtFinalStep
|
|
9258
|
+
});
|
|
9259
|
+
this.caseTriggerSubmitEventSub = this.caseEditDataService.caseTriggerSubmitEvent$.subscribe({
|
|
9246
9260
|
next: state => {
|
|
9247
9261
|
if (state) {
|
|
9248
9262
|
this.caseEditDataService.setTriggerSubmitEvent(false);
|
|
@@ -9255,6 +9269,17 @@ class CaseEditPageComponent {
|
|
|
9255
9269
|
ngAfterViewChecked() {
|
|
9256
9270
|
this.cdRef.detectChanges();
|
|
9257
9271
|
}
|
|
9272
|
+
ngOnDestroy() {
|
|
9273
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9274
|
+
(_a = this.routeParamsSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
9275
|
+
(_b = this.caseEditFormSub) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
9276
|
+
(_c = this.caseIsLinkedCasesJourneyAtFinalStepSub) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
9277
|
+
(_d = this.caseTriggerSubmitEventSub) === null || _d === void 0 ? void 0 : _d.unsubscribe();
|
|
9278
|
+
(_e = this.validateSub) === null || _e === void 0 ? void 0 : _e.unsubscribe();
|
|
9279
|
+
(_f = this.dialogRefAfterClosedSub) === null || _f === void 0 ? void 0 : _f.unsubscribe();
|
|
9280
|
+
(_g = this.saveDraftSub) === null || _g === void 0 ? void 0 : _g.unsubscribe();
|
|
9281
|
+
(_h = this.caseFormValidationErrorsSub) === null || _h === void 0 ? void 0 : _h.unsubscribe();
|
|
9282
|
+
}
|
|
9258
9283
|
applyValuesChanged(valuesChanged) {
|
|
9259
9284
|
this.formValuesChanged = valuesChanged;
|
|
9260
9285
|
}
|
|
@@ -9328,7 +9353,7 @@ class CaseEditPageComponent {
|
|
|
9328
9353
|
this.generateErrorMessage(casefield.field_type.collection_field_type.complex_fields, c.get('value'), id);
|
|
9329
9354
|
});
|
|
9330
9355
|
}
|
|
9331
|
-
else if (FieldsUtils.
|
|
9356
|
+
else if (FieldsUtils.isCaseFieldOfType(casefield, ['FlagLauncher'])) {
|
|
9332
9357
|
// Check whether the case field DisplayContextParameter is signalling "create" mode or "update" mode
|
|
9333
9358
|
// (expected always to be one of the two), to set the correct error message
|
|
9334
9359
|
let action = '';
|
|
@@ -9382,7 +9407,7 @@ class CaseEditPageComponent {
|
|
|
9382
9407
|
this.caseEdit.error = null;
|
|
9383
9408
|
const caseEventData = this.buildCaseEventData();
|
|
9384
9409
|
const loadingSpinnerToken = this.loadingService.register();
|
|
9385
|
-
this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
9410
|
+
this.validateSub = this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
9386
9411
|
.pipe(finalize(() => {
|
|
9387
9412
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9388
9413
|
}))
|
|
@@ -9482,7 +9507,7 @@ class CaseEditPageComponent {
|
|
|
9482
9507
|
if (this.eventTrigger.can_save_draft) {
|
|
9483
9508
|
if (this.formValuesChanged) {
|
|
9484
9509
|
const dialogRef = this.dialog.open(SaveOrDiscardDialogComponent, this.dialogConfig);
|
|
9485
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
9510
|
+
this.dialogRefAfterClosedSub = dialogRef.afterClosed().subscribe(result => {
|
|
9486
9511
|
if (result === 'Discard') {
|
|
9487
9512
|
this.discard();
|
|
9488
9513
|
}
|
|
@@ -9568,7 +9593,7 @@ class CaseEditPageComponent {
|
|
|
9568
9593
|
const draftCaseEventData = this.formValueService.sanitise(this.editForm.value);
|
|
9569
9594
|
draftCaseEventData.event_token = this.eventTrigger.event_token;
|
|
9570
9595
|
draftCaseEventData.ignore_warning = this.caseEdit.ignoreWarning;
|
|
9571
|
-
this.caseEdit.saveDraft(draftCaseEventData).subscribe((draft) => this.eventTrigger.case_id = DRAFT_PREFIX + draft.id, error => this.handleError(error));
|
|
9596
|
+
this.saveDraftSub = this.caseEdit.saveDraft(draftCaseEventData).subscribe((draft) => this.eventTrigger.case_id = DRAFT_PREFIX + draft.id, error => this.handleError(error));
|
|
9572
9597
|
}
|
|
9573
9598
|
}
|
|
9574
9599
|
getCaseFields() {
|
|
@@ -9631,7 +9656,7 @@ class CaseEditPageComponent {
|
|
|
9631
9656
|
this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
|
|
9632
9657
|
this.caseEditDataService.setCaseTitle(this.getCaseTitle());
|
|
9633
9658
|
this.caseEditDataService.setCaseEditForm(this.editForm);
|
|
9634
|
-
this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
9659
|
+
this.caseFormValidationErrorsSub = this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
9635
9660
|
next: (validationErrors) => this.validationErrors = validationErrors
|
|
9636
9661
|
});
|
|
9637
9662
|
}
|
|
@@ -23345,9 +23370,10 @@ class CaseEditSubmitComponent {
|
|
|
23345
23370
|
this.contextFields = this.getCaseFields();
|
|
23346
23371
|
// Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
|
|
23347
23372
|
// a FlagLauncher field in the event trigger
|
|
23348
|
-
this.caseEdit.isCaseFlagSubmission =
|
|
23373
|
+
this.caseEdit.isCaseFlagSubmission =
|
|
23374
|
+
this.eventTrigger.case_fields.some(caseField => FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']));
|
|
23349
23375
|
this.caseEdit.isLinkedCasesSubmission =
|
|
23350
|
-
this.eventTrigger.case_fields.some(caseField => FieldsUtils.
|
|
23376
|
+
this.eventTrigger.case_fields.some(caseField => FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']));
|
|
23351
23377
|
this.pageTitle = this.caseEdit.isCaseFlagSubmission ? 'Review flag details' : 'Check your answers';
|
|
23352
23378
|
}
|
|
23353
23379
|
ngOnDestroy() {
|
|
@@ -23415,29 +23441,30 @@ class CaseEditSubmitComponent {
|
|
|
23415
23441
|
}
|
|
23416
23442
|
checkYourAnswerFieldsToDisplayExists() {
|
|
23417
23443
|
/* istanbul ignore else */
|
|
23418
|
-
if (
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
return true;
|
|
23444
|
+
if (this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) {
|
|
23445
|
+
for (const page of this.wizard.pages) {
|
|
23446
|
+
/* istanbul ignore else */
|
|
23447
|
+
if (page.case_fields && this.isShown(page)) {
|
|
23448
|
+
for (const field of page.case_fields) {
|
|
23449
|
+
/* istanbul ignore else */
|
|
23450
|
+
if (this.canShowFieldInCYA(field)) {
|
|
23451
|
+
// at least one field needs showing
|
|
23452
|
+
return true;
|
|
23453
|
+
}
|
|
23429
23454
|
}
|
|
23430
23455
|
}
|
|
23431
23456
|
}
|
|
23432
23457
|
}
|
|
23433
|
-
|
|
23434
|
-
|
|
23458
|
+
else {
|
|
23459
|
+
// found no fields to show in CYA summary page
|
|
23460
|
+
return false;
|
|
23461
|
+
}
|
|
23435
23462
|
}
|
|
23436
23463
|
readOnlySummaryFieldsToDisplayExists() {
|
|
23437
23464
|
return this.eventTrigger.case_fields.some(field => field.show_summary_content_option >= 0);
|
|
23438
23465
|
}
|
|
23439
23466
|
showEventNotes() {
|
|
23440
|
-
return this.eventTrigger.show_event_notes
|
|
23467
|
+
return !!this.eventTrigger.show_event_notes;
|
|
23441
23468
|
}
|
|
23442
23469
|
getLastPageShown() {
|
|
23443
23470
|
let lastPage;
|
|
@@ -26084,7 +26111,7 @@ class CaseResolver {
|
|
|
26084
26111
|
}
|
|
26085
26112
|
else {
|
|
26086
26113
|
return this.caseNotifier.fetchAndRefresh(cid)
|
|
26087
|
-
.pipe(catchError(error => this.checkAuthorizationError(error)))
|
|
26114
|
+
.pipe(catchError(error => this.checkAuthorizationError(error, cid)))
|
|
26088
26115
|
.toPromise();
|
|
26089
26116
|
}
|
|
26090
26117
|
}
|
|
@@ -26096,20 +26123,24 @@ class CaseResolver {
|
|
|
26096
26123
|
this.caseNotifier.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
|
|
26097
26124
|
this.caseNotifier.announceCase(this.caseNotifier.cachedCaseView);
|
|
26098
26125
|
return this.caseNotifier.cachedCaseView;
|
|
26099
|
-
}), catchError(error => this.checkAuthorizationError(error))).toPromise();
|
|
26126
|
+
}), catchError(error => this.checkAuthorizationError(error, cid))).toPromise();
|
|
26100
26127
|
}
|
|
26101
|
-
checkAuthorizationError(error) {
|
|
26128
|
+
checkAuthorizationError(error, caseReference) {
|
|
26102
26129
|
// TODO Should be logged to remote logging infrastructure
|
|
26103
26130
|
if (error.status === 400) {
|
|
26104
26131
|
this.router.navigate(['/search/noresults']);
|
|
26105
26132
|
return of(null);
|
|
26106
26133
|
}
|
|
26107
|
-
console.error(error);
|
|
26108
26134
|
if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
|
|
26109
26135
|
this.router.navigate(['/list/case']);
|
|
26110
26136
|
return of(null);
|
|
26111
26137
|
}
|
|
26112
|
-
|
|
26138
|
+
// Error 403, navigate to restricted case access page
|
|
26139
|
+
if (error.status === 403) {
|
|
26140
|
+
this.router.navigate([`/cases/restricted-case-access/${caseReference}`]);
|
|
26141
|
+
return of(null);
|
|
26142
|
+
}
|
|
26143
|
+
if (error.status !== 401) {
|
|
26113
26144
|
this.router.navigate(['/error']);
|
|
26114
26145
|
}
|
|
26115
26146
|
this.goToDefaultPage();
|