diff --git a/package.json b/package.json
index c4bcc203d2..6327a05e03 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
- "version": "7.1.15-fix-event-hiding",
+ "version": "7.1.22",
"engines": {
"node": ">=18.19.0"
},
diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json
index 5afc666adf..350cda0a43 100644
--- a/projects/ccd-case-ui-toolkit/package.json
+++ b/projects/ccd-case-ui-toolkit/package.json
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
- "version": "7.1.15-fix-event-hiding",
+ "version": "7.1.22",
"engines": {
"node": ">=18.19.0"
},
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts
index 172d7443ec..d8f5593492 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-editor/services/page-validation.service.ts
@@ -14,15 +14,15 @@ export class PageValidationService {
public getInvalidFields(page: WizardPage, editForm: FormGroup): CaseField[] {
const failingCaseFields = [];
page.case_fields
- .filter(caseField => !this.caseFieldService.isReadOnly(caseField))
- .filter(caseField => !this.isHidden(caseField, editForm))
- .forEach(caseField => {
+ .filter((caseField) => !this.caseFieldService.isReadOnly(caseField))
+ .filter((caseField) => !this.isHidden(caseField, editForm))
+ .forEach((caseField) => {
const theControl = FieldsUtils.isCaseFieldOfType(caseField, ['JudicialUser'])
- ? editForm.controls['data'].get(`${caseField.id}_judicialUserControl`)
- : editForm.controls['data'].get(caseField.id);
+ ? editForm.controls.data.get(`${caseField.id}_judicialUserControl`)
+ : editForm.controls.data.get(caseField.id);
if (!(this.checkDocumentField(caseField, theControl) && this.checkOptionalField(caseField, theControl))) {
failingCaseFields.push(caseField);
- };
+ }
});
return failingCaseFields;
}
@@ -46,9 +46,8 @@ export class PageValidationService {
private checkOptionalField(caseField: CaseField, theControl: AbstractControl): boolean {
if (!theControl) {
return this.caseFieldService.isOptional(caseField);
- } else {
- return theControl.valid || theControl.disabled;
}
+ return theControl.valid || theControl.disabled;
}
private checkMandatoryField(caseField: CaseField, theControl: AbstractControl): boolean {
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts
index ddbb437155..7c38d0f90a 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/case-header/case-header.component.ts
@@ -10,17 +10,25 @@ import { Draft } from '../../domain/draft.model';
})
export class CaseHeaderComponent implements OnInit {
- @Input() public caseDetails: CaseView;
+
+ @Input()
+ public caseDetails: CaseView;
public caseTitle: CaseField;
public caseFields: CaseField[];
public ngOnInit(): void {
this.caseTitle = new CaseField();
- this.caseTitle.label = this.caseDetails.state.title_display;
- this.caseFields = this.getCaseFieldsInfo();
+ if (!this.isDraft() && this.caseDetails.state.title_display) {
+ this.caseTitle.label = this.caseDetails.state.title_display;
+ this.caseFields = this.getCaseFields();
+ }
+ }
+
+ public isDraft(): boolean {
+ return Draft.isDraft(this.caseDetails.case_id);
}
- private getCaseFieldsInfo(): CaseField[] {
+ private getCaseFields(): CaseField[] {
const caseDataFields = this.caseDetails.tabs.reduce((acc, tab) => {
return acc.concat(tab.fields);
}, []);
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts
index a7215ad5bf..ad077e38e8 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.ts
@@ -98,24 +98,6 @@ export class SelectFlagTypeComponent implements OnInit, OnDestroy {
}
);
- this.formGroup.addControl(CaseFlagFormFields.FLAG_TYPE, new FormControl(''));
- this.formGroup.addControl(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION, new FormControl(''));
- this.formGroup.addControl(CaseFlagFormFields.IS_VISIBLE_INTERNALLY_ONLY, new FormControl(''));
-
- // Should clear descriptionControlName if flagTypeControlName is changed
- this.flagTypeControlChangesSubscription = this.formGroup.get(CaseFlagFormFields.FLAG_TYPE).valueChanges
- .subscribe(_ => {
- this.formGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION).setValue('');
- this.cachedPath = [];
-
- // required to clear language interpreter
- this.formGroup.patchValue({
- [SearchLanguageInterpreterControlNames.LANGUAGE_SEARCH_TERM]: '',
- [SearchLanguageInterpreterControlNames.MANUAL_LANGUAGE_ENTRY]: ''
- });
- }
- );
-
// If hmctsServiceId is present, use this to retrieve the relevant list of flag types
if (this.hmctsServiceId) {
this.flagRefdata$ = this.caseFlagRefdataService
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html
index 50eaef8432..ab76b7d823 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.html
@@ -27,10 +27,6 @@
type="radio" [formControl]="qualifyingQuestionsControl" [value]="qualifyingQuestion">
-
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts
index 50d3f0acd5..7a6ae94634 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.spec.ts
@@ -66,7 +66,7 @@ describe('QualifyingQuestionOptionsComponent', () => {
it('should have the link to case details queries tab', () => {
component.click();
- expect(router.navigate).toHaveBeenCalledWith(['cases', 'case-details', '12345'], { fragment: 'Query Management' });
+ expect(router.navigate).toHaveBeenCalledWith(['cases', 'case-details', '12345'], { fragment: 'Queries' });
});
describe('displayError', () => {
@@ -109,5 +109,15 @@ describe('QualifyingQuestionOptionsComponent', () => {
expect(errorMessageEl).toBeTruthy();
expect(errorMessageEl.nativeElement.textContent.trim()).toBe(`Error: ${QualifyingQuestionsErrorMessage.SELECT_AN_OPTION}`);
});
+
+ it('should initialize qualifyingQuestionsControl with saved selection if available', () => {
+ const savedSelection = 'saved-option';
+ qualifyingQuestionService.getQualifyingQuestionSelection.and.returnValue(savedSelection);
+
+ component.ngOnInit();
+
+ expect(qualifyingQuestionService.getQualifyingQuestionSelection).toHaveBeenCalled();
+ expect(component.qualifyingQuestionsControl.value).toBe(savedSelection);
+ });
});
});
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts
index f809a37a50..765a6115be 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts
@@ -33,7 +33,7 @@ export class QualifyingQuestionOptionsComponent implements OnInit {
}
public click(): void {
- this.router.navigate(['cases', 'case-details', this.caseId], { fragment: 'Query Management' });
+ this.router.navigate(['cases', 'case-details', this.caseId], { fragment: 'Queries' });
}
public get displayError(): boolean {
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts
index e923fddb14..b664b3738a 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-case-details-header/query-case-details-header.component.ts
@@ -1,37 +1,24 @@
import { Component, Input, OnInit } from '@angular/core';
import { CaseView } from '../../../../../domain/case-view/case-view.model';
import { CaseField } from '../../../../../domain/definition/case-field.model';
-import { Draft } from '../../../../../domain/draft.model';
-import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'ccd-query-case-details-header',
templateUrl: './query-case-details-header.component.html'
})
+
export class QueryCaseDetailsHeaderComponent implements OnInit {
- @Input()
- public caseDetails: CaseView;
+ @Input() public caseDetails: CaseView;
public caseTitle: CaseField;
public caseFields: CaseField[];
- public caseView: CaseView;
-
- constructor(activatedRoute: ActivatedRoute) {
- this.caseView = activatedRoute.snapshot.data.case;
- }
public ngOnInit(): void {
this.caseTitle = new CaseField();
- if (!this.isDraft() && this.caseDetails.state.title_display) {
- this.caseTitle.label = this.caseDetails.state.title_display;
- this.caseFields = this.getCaseFields();
- }
- }
-
- public isDraft(): boolean {
- return Draft.isDraft(this.caseDetails.case_id);
+ this.caseTitle.label = this.caseDetails.state.title_display;
+ this.caseFields = this.getCaseFieldsInfo();
}
- private getCaseFields(): CaseField[] {
+ private getCaseFieldsInfo(): CaseField[] {
const caseDataFields = this.caseDetails.tabs.reduce((acc, tab) => {
return acc.concat(tab.fields);
}, []);
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts
index 7cf440f594..5d37a728fa 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/enums/query-item-response-status.enum.ts
@@ -1,4 +1,5 @@
export enum QueryItemResponseStatus {
NEW = 'New',
- RESPONDED = 'Responded'
+ RESPONDED = 'Responded',
+ AWAITING = 'Awaiting Response'
}
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts
index e52e9b2a04..8241ce41d7 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.spec.ts
@@ -56,11 +56,11 @@ describe('QueryListItem', () => {
hearingDate: '',
createdOn: new Date('2023-06-01'),
createdBy: 'Person D',
- parentId: '444-444',
+ parentId: '444-444'
}
];
- const childrenItems = items.map(item => {
+ const childrenItems = items.map((item) => {
const listItem = new QueryListItem();
Object.assign(listItem, item);
return listItem;
@@ -163,7 +163,37 @@ describe('QueryListItem', () => {
it('should return "No response required" when it has no children', () => {
queryListItem.children = [];
expect(queryListItem.children).toEqual([]);
- expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.NEW);
+ expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.AWAITING);
+ });
+
+ it('should return "Awaiting Response" when it has children and is for Follow up question', () => {
+ // Create additional child items
+ const additionalChildren = [
+ new QueryListItem(),
+ new QueryListItem(),
+ new QueryListItem(),
+ new QueryListItem()
+ ].map((child, index) => {
+ Object.assign(child, {
+ id: `child-${index + 1}`,
+ subject: `Subject ${index + 2}`,
+ name: `Name ${index + 2}`,
+ body: `Body ${index + 2}`,
+ attachments: [],
+ isHearingRelated: false,
+ hearingDate: '',
+ createdOn: new Date(`2021-0${index + 2}-01`),
+ createdBy: `Person ${String.fromCharCode(65 + index + 1)}`,
+ parentId: queryListItem.id,
+ children: []
+ });
+ return child;
+ });
+
+ // Assign these new children to queryListItem
+ queryListItem.children = additionalChildren;
+ expect(queryListItem.children.length).toEqual(4);
+ expect(queryListItem.responseStatus).toEqual(QueryItemResponseStatus.AWAITING);
});
});
});
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts
index 57c54dd275..739adbc1c6 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/models/query-list/query-list-item/query-list-item.model.ts
@@ -50,6 +50,11 @@ export class QueryListItem implements CaseMessage {
}
public get responseStatus(): QueryItemResponseStatus {
- return this.children?.length > 0 ? QueryItemResponseStatus.RESPONDED : QueryItemResponseStatus.NEW;
+ if (this.children?.length > 0) {
+ return this.children.length % 2 === 1
+ ? QueryItemResponseStatus.RESPONDED
+ : QueryItemResponseStatus.AWAITING;
+ }
+ return QueryItemResponseStatus.AWAITING;
}
}
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts
index 8955ea21be..158695b50d 100644
--- a/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts
+++ b/projects/ccd-case-ui-toolkit/src/lib/shared/services/jurisdiction/jurisdiction.service.ts
@@ -20,7 +20,6 @@ export class JurisdictionService {
}
public announceSelectedJurisdiction(jurisdiction: Jurisdiction): void {
- console.info ('Announcing selected jurisdiction = ' + jurisdiction?.id);
this.selectedJurisdictionSource.next(jurisdiction);
this.selectedJurisdictionBS.next(jurisdiction);
}