@hmcts/ccd-case-ui-toolkit 7.2.54-3455-rc3 → 7.2.54-3759-rc1

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.
@@ -3932,6 +3932,9 @@ class FieldsUtils {
3932
3932
  static SERVER_RESPONSE_FIELD_TYPE_COLLECTION = 'Collection';
3933
3933
  static SERVER_RESPONSE_FIELD_TYPE_COMPLEX = 'Complex';
3934
3934
  static SERVER_RESPONSE_FIELD_TYPE_DYNAMIC_LIST_TYPE = ['DynamicList', 'DynamicRadioList'];
3935
+ static defaultTabList = {
3936
+ "PRLAPPS": "Summary"
3937
+ };
3935
3938
  static isValidDisplayContext(ctx) {
3936
3939
  return (ctx === 'MANDATORY' || ctx === 'READONLY'
3937
3940
  || ctx === 'OPTIONAL' || ctx === 'HIDDEN'
@@ -9301,17 +9304,6 @@ class CaseEditComponent {
9301
9304
  this.router.navigate([this.initialUrl], { relativeTo: this.route });
9302
9305
  return true;
9303
9306
  }
9304
- // if the url contains /submit there is the potential that the user has gone straight to the submit page
9305
- // we should try and work out if they have been through the journey or not and prevent them submitting directly
9306
- if (this.router.url.indexOf('/submit') !== -1 && !this.initialUrl) {
9307
- // we only want to check if the user has done this if there is a multi-page journey
9308
- if (this.eventTrigger.wizard_pages && this.eventTrigger.wizard_pages.length > 0) {
9309
- console.log('User has navigated to the end of an event journey directly, reset their journey');
9310
- const firstPage = this.eventTrigger.wizard_pages.reduce((min, page) => page.order < min.order ? page : min, this.eventTrigger.wizard_pages[0]);
9311
- this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
9312
- this.router.navigate([firstPage ? firstPage.id : 'submit'], { relativeTo: this.route });
9313
- }
9314
- }
9315
9307
  return false;
9316
9308
  }
9317
9309
  getPage(pageId) {
@@ -35861,8 +35853,24 @@ class CaseFullAccessViewComponent {
35861
35853
  else {
35862
35854
  // sort with the order of CCD predefined tabs
35863
35855
  this.caseDetails.tabs.sort((aTab, bTab) => aTab.order > bTab.order ? 1 : (bTab.order > aTab.order ? -1 : 0));
35864
- // select the first tab checking if the tab is visible
35865
- const preSelectTab = this.findPreSelectedActiveTab();
35856
+ // Prefer tab from FieldsUtils.defaultTabList (e.g. PRLAPPS -> Summary) if present
35857
+ const preferredLabel = FieldsUtils.defaultTabList?.[this.caseDetails?.case_type?.id];
35858
+ let preSelectTab = null;
35859
+ if (preferredLabel) {
35860
+ preSelectTab = this.caseDetails.tabs.find(t => (t.label === preferredLabel) || (t.id === preferredLabel)) ?? null;
35861
+ }
35862
+ // Fallback to first visible tab if no preferred label found
35863
+ if (!preSelectTab) {
35864
+ preSelectTab = this.findPreSelectedActiveTab();
35865
+ }
35866
+ // If the preferred tab exists in caseDetails but is hidden (not rendered in tabGroup), fallback again
35867
+ const renderedTabs = this.tabGroup?._tabs?.toArray?.() ?? [];
35868
+ const preferredRendered = preSelectTab &&
35869
+ renderedTabs.some(mt => mt.textLabel === preSelectTab.label || mt.textLabel?.toLowerCase() === preSelectTab.label?.toLowerCase());
35870
+ if (!preferredRendered) {
35871
+ // Default focus: keep natural first visible tab (do not change selectedIndex explicitly)
35872
+ preSelectTab = this.findPreSelectedActiveTab();
35873
+ }
35866
35874
  this.router.navigate(['cases', 'case-details', this.caseDetails.case_type.jurisdiction.id, this.caseDetails.case_type.id, this.caseDetails.case_id], { fragment: preSelectTab.label }).then(() => {
35867
35875
  matTab = this.tabGroup._tabs.find((x) => x.textLabel === preSelectTab.label);
35868
35876
  // Update selectedIndex only if matTab.position is a non-zero number (positive or negative); this means the