@hmcts/ccd-case-ui-toolkit 7.1.57 → 7.1.59
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/esm2022/lib/shared/components/case-viewer/services/case.resolver.mjs +8 -1
- package/esm2022/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.mjs +72 -12
- package/esm2022/lib/shared/components/palette/query-management/utils/query-management.utils.mjs +4 -3
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +81 -13
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts +1 -0
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
- package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts +9 -0
- package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts.map +1 -1
- package/lib/shared/components/palette/query-management/utils/query-management.utils.d.ts +1 -0
- package/lib/shared/components/palette/query-management/utils/query-management.utils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -20847,11 +20847,12 @@ class QueryManagementUtils {
|
|
|
20847
20847
|
static caseLevelCaseFieldId = 'CaseQueriesCollection';
|
|
20848
20848
|
static FIELD_TYPE_COLLECTION = 'Collection';
|
|
20849
20849
|
static FIELD_TYPE_COMPLEX = 'Complex';
|
|
20850
|
+
static DISPLAY_CONTEXT_READONLY = 'READONLY';
|
|
20850
20851
|
static extractCaseQueriesFromCaseField(caseField) {
|
|
20851
|
-
const { field_type, value } = caseField;
|
|
20852
|
+
const { field_type, value, display_context } = caseField;
|
|
20852
20853
|
// Handle Complex type fields
|
|
20853
20854
|
if (field_type.type === QueryManagementUtils.FIELD_TYPE_COMPLEX) {
|
|
20854
|
-
if (field_type.id === QueryManagementUtils.caseLevelCaseFieldId && QueryManagementUtils.isNonEmptyObject(value)) {
|
|
20855
|
+
if (field_type.id === QueryManagementUtils.caseLevelCaseFieldId && display_context !== QueryManagementUtils.DISPLAY_CONTEXT_READONLY && QueryManagementUtils.isNonEmptyObject(value)) {
|
|
20855
20856
|
return value;
|
|
20856
20857
|
}
|
|
20857
20858
|
return null;
|
|
@@ -21123,6 +21124,9 @@ class QueryCheckYourAnswersComponent {
|
|
|
21123
21124
|
CASE_QUERIES_COLLECTION_ID = 'CaseQueriesCollection';
|
|
21124
21125
|
FIELD_TYPE_COMPLEX = 'Complex';
|
|
21125
21126
|
DISPLAY_CONTEXT_READONLY = 'READONLY';
|
|
21127
|
+
QM_SELECT_FIRST_COLLECTION = 'selectFirstCollection';
|
|
21128
|
+
QM_COLLECTION_PROMPT = 'promptQmCollection';
|
|
21129
|
+
CIVIL_JURISDICTION = 'CIVIL';
|
|
21126
21130
|
formGroup;
|
|
21127
21131
|
queryItem;
|
|
21128
21132
|
queryCreateContext;
|
|
@@ -21135,6 +21139,8 @@ class QueryCheckYourAnswersComponent {
|
|
|
21135
21139
|
tid;
|
|
21136
21140
|
createEventSubscription;
|
|
21137
21141
|
searchTasksSubscription;
|
|
21142
|
+
firstCollectionPicked = false; // Track whether the first collection has been picked
|
|
21143
|
+
firstCollectionOrder;
|
|
21138
21144
|
queryCreateContextEnum = QueryCreateContext;
|
|
21139
21145
|
eventCompletionParams;
|
|
21140
21146
|
caseQueriesCollections;
|
|
@@ -21171,11 +21177,13 @@ class QueryCheckYourAnswersComponent {
|
|
|
21171
21177
|
.subscribe({
|
|
21172
21178
|
next: (response) => {
|
|
21173
21179
|
// Filter task by query id
|
|
21174
|
-
if (this.tid
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21180
|
+
if (this.tid) {
|
|
21181
|
+
if (response.tasks?.length > 1) {
|
|
21182
|
+
this.filteredTasks = response.tasks?.filter((task) => task.id === this.tid);
|
|
21183
|
+
}
|
|
21184
|
+
else {
|
|
21185
|
+
this.filteredTasks = response.tasks;
|
|
21186
|
+
}
|
|
21179
21187
|
}
|
|
21180
21188
|
},
|
|
21181
21189
|
error: (error) => {
|
|
@@ -21214,7 +21222,14 @@ class QueryCheckYourAnswersComponent {
|
|
|
21214
21222
|
});
|
|
21215
21223
|
}
|
|
21216
21224
|
else {
|
|
21217
|
-
console.error('Error: No task to complete found');
|
|
21225
|
+
console.error('Error: No task to complete was found');
|
|
21226
|
+
this.errorMessages = [
|
|
21227
|
+
{
|
|
21228
|
+
title: 'Error',
|
|
21229
|
+
description: 'No task to complete was found',
|
|
21230
|
+
fieldId: 'field-id'
|
|
21231
|
+
}
|
|
21232
|
+
];
|
|
21218
21233
|
}
|
|
21219
21234
|
}
|
|
21220
21235
|
else {
|
|
@@ -21329,10 +21344,17 @@ class QueryCheckYourAnswersComponent {
|
|
|
21329
21344
|
const messageId = this.route.snapshot.params.dataid;
|
|
21330
21345
|
// Check if the field_type matches CaseQueriesCollection and type is Complex
|
|
21331
21346
|
if (data.field_type.id === this.CASE_QUERIES_COLLECTION_ID && data.field_type.type === this.FIELD_TYPE_COMPLEX) {
|
|
21332
|
-
if (this.
|
|
21333
|
-
|
|
21334
|
-
|
|
21335
|
-
|
|
21347
|
+
if (this.isNewQueryContext(data)) {
|
|
21348
|
+
// If there is more than one qmCaseQueriesCollection, pick the one with the lowest order
|
|
21349
|
+
if (count > 1) {
|
|
21350
|
+
if (!this.handleMultipleCollections()) {
|
|
21351
|
+
return;
|
|
21352
|
+
}
|
|
21353
|
+
}
|
|
21354
|
+
else {
|
|
21355
|
+
// Set the field ID dynamically based on the extracted data
|
|
21356
|
+
this.fieldId = id; // Store the ID for use in generating newQueryData
|
|
21357
|
+
}
|
|
21336
21358
|
}
|
|
21337
21359
|
// If messageId is present, find the corresponding case message
|
|
21338
21360
|
this.setMessageFieldId(messageId, value, id);
|
|
@@ -21347,6 +21369,45 @@ class QueryCheckYourAnswersComponent {
|
|
|
21347
21369
|
}
|
|
21348
21370
|
}
|
|
21349
21371
|
}
|
|
21372
|
+
isNewQueryContext(data) {
|
|
21373
|
+
return this.queryCreateContext === QueryCreateContext.NEW_QUERY && data.display_context !== this.DISPLAY_CONTEXT_READONLY;
|
|
21374
|
+
}
|
|
21375
|
+
handleMultipleCollections() {
|
|
21376
|
+
const jurisdictionId = this.caseDetails?.case_type?.jurisdiction?.id;
|
|
21377
|
+
if (!jurisdictionId) {
|
|
21378
|
+
console.error('Jurisdiction ID is missing.');
|
|
21379
|
+
return false;
|
|
21380
|
+
}
|
|
21381
|
+
if (this.getCollectionSelectionMethod(jurisdictionId) === this.QM_SELECT_FIRST_COLLECTION) {
|
|
21382
|
+
// Pick the collection with the lowest order
|
|
21383
|
+
this.fieldId = this.getCaseQueriesCollectionFieldOrderFromWizardPages()?.id;
|
|
21384
|
+
}
|
|
21385
|
+
else {
|
|
21386
|
+
// Display Error, for now, until EXUI-2644 is implemented
|
|
21387
|
+
console.error(`Error: Multiple CaseQueriesCollections are not supported yet for the ${jurisdictionId} jurisdiction`);
|
|
21388
|
+
return false;
|
|
21389
|
+
}
|
|
21390
|
+
return true;
|
|
21391
|
+
}
|
|
21392
|
+
getCaseQueriesCollectionFieldOrderFromWizardPages() {
|
|
21393
|
+
const candidateFields = this.eventData?.case_fields?.filter((field) => field.field_type.id === this.CASE_QUERIES_COLLECTION_ID &&
|
|
21394
|
+
field.field_type.type === this.FIELD_TYPE_COMPLEX &&
|
|
21395
|
+
field.display_context !== this.DISPLAY_CONTEXT_READONLY);
|
|
21396
|
+
if (!candidateFields?.length)
|
|
21397
|
+
return undefined;
|
|
21398
|
+
const firstPageFields = this.eventData?.wizard_pages?.[0]?.wizard_page_fields;
|
|
21399
|
+
if (!firstPageFields)
|
|
21400
|
+
return undefined;
|
|
21401
|
+
return candidateFields
|
|
21402
|
+
.map((field) => {
|
|
21403
|
+
const wizardField = firstPageFields.find(f => f.case_field_id === field.id);
|
|
21404
|
+
return { field, order: wizardField?.order ?? Number.MAX_SAFE_INTEGER };
|
|
21405
|
+
})
|
|
21406
|
+
.sort((a, b) => a.order - b.order)[0]?.field;
|
|
21407
|
+
}
|
|
21408
|
+
getCollectionSelectionMethod(jurisdiction) {
|
|
21409
|
+
return jurisdiction.toUpperCase() === this.CIVIL_JURISDICTION ? this.QM_SELECT_FIRST_COLLECTION : this.QM_COLLECTION_PROMPT;
|
|
21410
|
+
}
|
|
21350
21411
|
getDocumentAttachments() {
|
|
21351
21412
|
const attachmentsValue = this.formGroup.get('attachments').value;
|
|
21352
21413
|
if (attachmentsValue && attachmentsValue.length > 0) {
|
|
@@ -21439,7 +21500,7 @@ class QueryCheckYourAnswersComponent {
|
|
|
21439
21500
|
}], querySubmitted: [{
|
|
21440
21501
|
type: Output
|
|
21441
21502
|
}] }); })();
|
|
21442
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryCheckYourAnswersComponent, { className: "QueryCheckYourAnswersComponent", filePath: "lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.ts", lineNumber:
|
|
21503
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryCheckYourAnswersComponent, { className: "QueryCheckYourAnswersComponent", filePath: "lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.ts", lineNumber: 26 }); })();
|
|
21443
21504
|
|
|
21444
21505
|
function QueryDetailsComponent_ng_container_0_cut_alert_1_Template(rf, ctx) { if (rf & 1) {
|
|
21445
21506
|
i0.ɵɵelementStart(0, "cut-alert", 11);
|
|
@@ -33489,6 +33550,7 @@ class CaseResolver {
|
|
|
33489
33550
|
static EVENT_REGEX = new RegExp('\/trigger\/.*?\/submit$');
|
|
33490
33551
|
static PARAM_CASE_ID = 'cid';
|
|
33491
33552
|
static CASE_CREATED_MSG = 'The case has been created successfully';
|
|
33553
|
+
static EVENT_ID_QM_RESPOND_TO_QUERY = 'eventId=queryManagementRespondQuery';
|
|
33492
33554
|
static defaultWAPage = '/work/my-work/list';
|
|
33493
33555
|
static defaultPage = '/cases';
|
|
33494
33556
|
// we need to run the CaseResolver on every child route of 'case/:jid/:ctid/:cid'
|
|
@@ -33509,6 +33571,12 @@ class CaseResolver {
|
|
|
33509
33571
|
}
|
|
33510
33572
|
resolve(route) {
|
|
33511
33573
|
const cid = route.paramMap.get(CaseResolver.PARAM_CASE_ID);
|
|
33574
|
+
const currentUrl = this.router.url ?? '';
|
|
33575
|
+
// Prevent resolving if eventId=queryManagementRespondQuery is in the URL
|
|
33576
|
+
if (currentUrl.includes(CaseResolver.EVENT_ID_QM_RESPOND_TO_QUERY)) {
|
|
33577
|
+
console.info('Skipping resolve for event queryManagementRespondQuery.');
|
|
33578
|
+
this.goToDefaultPage();
|
|
33579
|
+
}
|
|
33512
33580
|
if (!cid) {
|
|
33513
33581
|
console.info('No case ID available in the route. Will navigate to case list.');
|
|
33514
33582
|
// when redirected to case view after a case created, and the user has no READ access,
|