@hmcts/ccd-case-ui-toolkit 7.0.41-rc → 7.0.42

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.
Files changed (20) hide show
  1. package/esm2022/lib/app.config.mjs +4 -1
  2. package/esm2022/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.mjs +8 -3
  3. package/esm2022/lib/shared/components/palette/case-file-view/case-file-view-field.component.mjs +24 -9
  4. package/esm2022/lib/shared/components/palette/linked-cases/components/linked-cases-table/linked-cases-from-table.component.mjs +52 -20
  5. package/esm2022/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.mjs +7 -7
  6. package/esm2022/lib/shared/services/form/form-validators.service.mjs +3 -6
  7. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +88 -40
  8. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  9. package/lib/app.config.d.ts +4 -0
  10. package/lib/app.config.d.ts.map +1 -1
  11. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +1 -0
  12. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
  13. package/lib/shared/components/palette/case-file-view/case-file-view-field.component.d.ts +8 -1
  14. package/lib/shared/components/palette/case-file-view/case-file-view-field.component.d.ts.map +1 -1
  15. package/lib/shared/components/palette/linked-cases/components/linked-cases-table/linked-cases-from-table.component.d.ts +4 -0
  16. package/lib/shared/components/palette/linked-cases/components/linked-cases-table/linked-cases-from-table.component.d.ts.map +1 -1
  17. package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts +1 -1
  18. package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts.map +1 -1
  19. package/lib/shared/services/form/form-validators.service.d.ts.map +1 -1
  20. package/package.json +1 -1
@@ -1224,6 +1224,7 @@ var DisplayMode;
1224
1224
  DisplayMode[DisplayMode["ICON"] = 1] = "ICON";
1225
1225
  })(DisplayMode || (DisplayMode = {}));
1226
1226
 
1227
+ /* istanbul ignore file */
1227
1228
  class AbstractAppConfig {
1228
1229
  /**
1229
1230
  * Dummy version replacing deprecated `getRemotePrintServiceUrl()`, to be removed in next major release
@@ -1315,6 +1316,8 @@ class CaseEditorConfig {
1315
1316
  case_data_store_api_url;
1316
1317
  enable_restricted_case_access;
1317
1318
  enable_case_file_view_version_1_1;
1319
+ icp_enabled;
1320
+ icp_jurisdictions;
1318
1321
  }
1319
1322
 
1320
1323
  class HttpError {
@@ -4941,13 +4944,10 @@ class FormValidatorsService {
4941
4944
  return validator;
4942
4945
  }
4943
4946
  static markDownPatternValidator() {
4944
- const markdownPattern = /(\[[^\]]{0,500}\]\([^)]{0,500}\)|!\[[^\]]{0,500}\]\([^)]{0,500}\)|<img[^>]{0,500}>|<a[^>]{0,500}>.*?<\/a>)/;
4945
- const scriptPattern = /<script\b[^>]*>([\s\S]*?)<\/script>/;
4947
+ const pattern = /(\[[^\]]{0,500}\]\([^)]{0,500}\)|!\[[^\]]{0,500}\]\([^)]{0,500}\)|<img[^>]{0,500}>|<a[^>]{0,500}>.*?<\/a>)/;
4946
4948
  return (control) => {
4947
4949
  const value = control?.value?.toString().trim();
4948
- const markdownPatternMatch = value && markdownPattern.test(value);
4949
- const scriptPatternMatch = value && scriptPattern.test(value);
4950
- return (markdownPatternMatch || scriptPatternMatch) ? { markDownPattern: {} } : null;
4950
+ return (value && pattern.test(value)) ? { markDownPattern: {} } : null;
4951
4951
  };
4952
4952
  }
4953
4953
  // TODO: Strip this out as it's only here for the moment because
@@ -11875,7 +11875,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) { if
11875
11875
  } if (rf & 2) {
11876
11876
  const ctx_r1 = i0.ɵɵnextContext(2);
11877
11877
  i0.ɵɵadvance();
11878
- i0.ɵɵproperty("url", ctx_r1.currentDocument.document_binary_url)("downloadFileName", ctx_r1.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r1.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh");
11878
+ i0.ɵɵproperty("url", ctx_r1.currentDocument.document_binary_url)("downloadFileName", ctx_r1.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r1.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh")("enableICP", ctx_r1.isIcpEnabled());
11879
11879
  } }
11880
11880
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11881
11881
  const _r3 = i0.ɵɵgetCurrentView();
@@ -11887,7 +11887,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11887
11887
  i0.ɵɵelementEnd()();
11888
11888
  i0.ɵɵelement(6, "div", 16);
11889
11889
  i0.ɵɵelementStart(7, "div", 17);
11890
- i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 7, "ng-container", 0);
11890
+ i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 8, "ng-container", 0);
11891
11891
  i0.ɵɵelementEnd()()();
11892
11892
  } if (rf & 2) {
11893
11893
  const ctx_r1 = i0.ɵɵnextContext();
@@ -11903,6 +11903,8 @@ class CaseFileViewFieldComponent {
11903
11903
  documentManagementService;
11904
11904
  loadingService;
11905
11905
  sessionStorageService;
11906
+ caseNotifier;
11907
+ abstractConfig;
11906
11908
  static PARAM_CASE_ID = 'cid';
11907
11909
  allowMoving = true;
11908
11910
  categoriesAndDocuments$;
@@ -11912,13 +11914,17 @@ class CaseFileViewFieldComponent {
11912
11914
  errorMessages = [];
11913
11915
  caseVersion;
11914
11916
  caseField;
11915
- constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService) {
11917
+ icp_jurisdictions = [];
11918
+ icpEnabled = false;
11919
+ constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11916
11920
  this.elementRef = elementRef;
11917
11921
  this.route = route;
11918
11922
  this.caseFileViewService = caseFileViewService;
11919
11923
  this.documentManagementService = documentManagementService;
11920
11924
  this.loadingService = loadingService;
11921
11925
  this.sessionStorageService = sessionStorageService;
11926
+ this.caseNotifier = caseNotifier;
11927
+ this.abstractConfig = abstractConfig;
11922
11928
  }
11923
11929
  ngOnInit() {
11924
11930
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
@@ -11935,6 +11941,8 @@ class CaseFileViewFieldComponent {
11935
11941
  const acls = this.caseField.acls.filter(acl => userInfo.roles.includes(acl.role));
11936
11942
  // As there can be more than one intersecting role, if any acls are update: true
11937
11943
  this.allowMoving = acls.some(acl => acl.update);
11944
+ this.icp_jurisdictions = this.abstractConfig.getIcpJurisdictions();
11945
+ this.icpEnabled = this.abstractConfig.getIcpEnable();
11938
11946
  }
11939
11947
  ngAfterViewInit() {
11940
11948
  const slider = this.elementRef.nativeElement.querySelector('.slider');
@@ -11993,8 +12001,11 @@ class CaseFileViewFieldComponent {
11993
12001
  this.categoriesAndDocumentsSubscription.unsubscribe();
11994
12002
  }
11995
12003
  }
11996
- static ɵfac = function CaseFileViewFieldComponent_Factory(t) { return new (t || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService)); };
11997
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
12004
+ isIcpEnabled() {
12005
+ return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
12006
+ }
12007
+ static ɵfac = function CaseFileViewFieldComponent_Factory(t) { return new (t || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
12008
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
11998
12009
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0)(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1)(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
11999
12010
  } if (rf & 2) {
12000
12011
  i0.ɵɵproperty("ngIf", ctx.errorMessages == null ? null : ctx.errorMessages.length);
@@ -12006,9 +12017,9 @@ class CaseFileViewFieldComponent {
12006
12017
  }
12007
12018
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
12008
12019
  type: Component,
12009
- args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
12010
- }], () => [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }], null); })();
12011
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 15 }); })();
12020
+ args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [enableICP]=\"isIcpEnabled()\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
12021
+ }], () => [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }], null); })();
12022
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 17 }); })();
12012
12023
 
12013
12024
  class CaseFlagStateService {
12014
12025
  formGroup = new FormGroup({});
@@ -16676,25 +16687,48 @@ function LinkedCasesFromTableComponent_a_0_Template(rf, ctx) { if (rf & 1) {
16676
16687
  i0.ɵɵadvance();
16677
16688
  i0.ɵɵtextInterpolate(ctx_r1.showHideLinkText);
16678
16689
  } }
16690
+ function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_a_4_Template(rf, ctx) { if (rf & 1) {
16691
+ i0.ɵɵelementStart(0, "a", 20);
16692
+ i0.ɵɵtext(1);
16693
+ i0.ɵɵelementEnd();
16694
+ } if (rf & 2) {
16695
+ const case_r3 = i0.ɵɵnextContext(3).$implicit;
16696
+ const ctx_r1 = i0.ɵɵnextContext(3);
16697
+ i0.ɵɵpropertyInterpolate1("href", "cases/case-details/", case_r3.caseReference, "", i0.ɵɵsanitizeUrl);
16698
+ i0.ɵɵadvance();
16699
+ i0.ɵɵtextInterpolate(ctx_r1.getCaseReferenceLink(case_r3.caseReference));
16700
+ } }
16701
+ function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_br_5_Template(rf, ctx) { if (rf & 1) {
16702
+ i0.ɵɵelement(0, "br");
16703
+ } }
16679
16704
  function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_Template(rf, ctx) { if (rf & 1) {
16680
16705
  i0.ɵɵelementStart(0, "span");
16681
16706
  i0.ɵɵtext(1);
16682
16707
  i0.ɵɵpipe(2, "ccdLinkCasesFromReasonValue");
16683
- i0.ɵɵelement(3, "br");
16708
+ i0.ɵɵelementStart(3, "span");
16709
+ i0.ɵɵtemplate(4, LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_a_4_Template, 2, 3, "a", 18);
16710
+ i0.ɵɵelementEnd();
16711
+ i0.ɵɵtemplate(5, LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_br_5_Template, 1, 0, "br", 19);
16684
16712
  i0.ɵɵelementEnd();
16685
16713
  } if (rf & 2) {
16686
- const reason_r3 = ctx.$implicit;
16714
+ const reason_r4 = ctx.$implicit;
16715
+ const isLast_r5 = ctx.last;
16716
+ const ctx_r1 = i0.ɵɵnextContext(5);
16717
+ i0.ɵɵadvance();
16718
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 3, reason_r4), "");
16719
+ i0.ɵɵadvance(3);
16720
+ i0.ɵɵproperty("ngIf", ctx_r1.hasLeadCaseOrConsolidated(reason_r4.reasonCode));
16687
16721
  i0.ɵɵadvance();
16688
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 1, reason_r3), " ");
16722
+ i0.ɵɵproperty("ngIf", !isLast_r5);
16689
16723
  } }
16690
16724
  function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_Template(rf, ctx) { if (rf & 1) {
16691
16725
  i0.ɵɵelementStart(0, "td", 14);
16692
- i0.ɵɵtemplate(1, LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_Template, 4, 3, "span", 17);
16726
+ i0.ɵɵtemplate(1, LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_span_1_Template, 6, 5, "span", 17);
16693
16727
  i0.ɵɵelementEnd();
16694
16728
  } if (rf & 2) {
16695
- const details_r4 = ctx.$implicit;
16729
+ const details_r6 = ctx.$implicit;
16696
16730
  i0.ɵɵadvance();
16697
- i0.ɵɵproperty("ngForOf", details_r4.reasons);
16731
+ i0.ɵɵproperty("ngForOf", details_r6.reasons);
16698
16732
  } }
16699
16733
  function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_Template(rf, ctx) { if (rf & 1) {
16700
16734
  i0.ɵɵelementStart(0, "tr", 5)(1, "td", 11)(2, "p", 12)(3, "a", 13)(4, "span");
@@ -16715,28 +16749,28 @@ function LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_Template(rf, ctx) {
16715
16749
  i0.ɵɵtemplate(18, LinkedCasesFromTableComponent_table_1_tbody_13_tr_1_td_18_Template, 2, 1, "td", 16);
16716
16750
  i0.ɵɵelementEnd();
16717
16751
  } if (rf & 2) {
16718
- const case_r5 = ctx.$implicit;
16752
+ const case_r3 = ctx.$implicit;
16719
16753
  i0.ɵɵadvance(3);
16720
- i0.ɵɵpropertyInterpolate1("href", "cases/case-details/", case_r5.caseReference, "", i0.ɵɵsanitizeUrl);
16754
+ i0.ɵɵpropertyInterpolate1("href", "cases/case-details/", case_r3.caseReference, "", i0.ɵɵsanitizeUrl);
16721
16755
  i0.ɵɵadvance(2);
16722
- i0.ɵɵtextInterpolate1("", case_r5.caseNameHmctsInternal, " ");
16756
+ i0.ɵɵtextInterpolate1("", case_r3.caseNameHmctsInternal, " ");
16723
16757
  i0.ɵɵadvance(2);
16724
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(8, 10, case_r5.caseReference), "");
16758
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(8, 10, case_r3.caseReference), "");
16725
16759
  i0.ɵɵadvance(3);
16726
- i0.ɵɵproperty("title", case_r5.ccdCaseTypeDescription);
16760
+ i0.ɵɵproperty("title", case_r3.ccdCaseTypeDescription);
16727
16761
  i0.ɵɵadvance();
16728
- i0.ɵɵtextInterpolate(case_r5.ccdCaseType);
16762
+ i0.ɵɵtextInterpolate(case_r3.ccdCaseType);
16729
16763
  i0.ɵɵadvance(3);
16730
- i0.ɵɵtextInterpolate(case_r5.ccdJurisdiction);
16764
+ i0.ɵɵtextInterpolate(case_r3.ccdJurisdiction);
16731
16765
  i0.ɵɵadvance(2);
16732
- i0.ɵɵproperty("title", case_r5.stateDescription);
16766
+ i0.ɵɵproperty("title", case_r3.stateDescription);
16733
16767
  i0.ɵɵadvance();
16734
- i0.ɵɵtextInterpolate(case_r5.state);
16768
+ i0.ɵɵtextInterpolate(case_r3.state);
16735
16769
  i0.ɵɵadvance();
16736
- i0.ɵɵproperty("ngForOf", case_r5.linkDetails);
16770
+ i0.ɵɵproperty("ngForOf", case_r3.linkDetails);
16737
16771
  } }
16738
16772
  function LinkedCasesFromTableComponent_table_1_tbody_13_tr_2_Template(rf, ctx) { if (rf & 1) {
16739
- i0.ɵɵelementStart(0, "tr", 5)(1, "td", 18);
16773
+ i0.ɵɵelementStart(0, "tr", 5)(1, "td", 21);
16740
16774
  i0.ɵɵtext(2, " None ");
16741
16775
  i0.ɵɵelementEnd()();
16742
16776
  } }
@@ -16779,6 +16813,8 @@ class LinkedCasesFromTableComponent {
16779
16813
  casesService;
16780
16814
  linkedCasesService;
16781
16815
  static CASE_NAME_MISSING_TEXT = 'Case name missing';
16816
+ static CASE_CONSOLIDATED_REASON_CODE = 'CLRC015';
16817
+ static CASE_PROGRESS_REASON_CODE = 'CLRC016';
16782
16818
  caseField;
16783
16819
  notifyAPIFailure = new EventEmitter(false);
16784
16820
  caseDetails;
@@ -16845,13 +16881,20 @@ class LinkedCasesFromTableComponent {
16845
16881
  mapLookupIDToValueFromJurisdictions(fieldName, fieldValue) {
16846
16882
  return this.linkedCasesService.mapLookupIDToValueFromJurisdictions(fieldName, fieldValue);
16847
16883
  }
16884
+ getCaseReferenceLink(caseRef) {
16885
+ return caseRef.slice(this.caseId.length - 4);
16886
+ }
16887
+ hasLeadCaseOrConsolidated(reasonCode) {
16888
+ return reasonCode === LinkedCasesFromTableComponent.CASE_PROGRESS_REASON_CODE ||
16889
+ reasonCode === LinkedCasesFromTableComponent.CASE_CONSOLIDATED_REASON_CODE;
16890
+ }
16848
16891
  onClick() {
16849
16892
  this.showHideLinkText = this.showHideLinkText === 'Show'
16850
16893
  ? 'Hide'
16851
16894
  : 'Show';
16852
16895
  }
16853
16896
  static ɵfac = function LinkedCasesFromTableComponent_Factory(t) { return new (t || LinkedCasesFromTableComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(LinkedCasesService)); };
16854
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LinkedCasesFromTableComponent, selectors: [["ccd-linked-cases-from-table"]], inputs: { caseField: "caseField" }, outputs: { notifyAPIFailure: "notifyAPIFailure" }, decls: 2, vars: 2, consts: [["id", "show-hide-link", "class", "govuk-link", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], ["aria-describedby", "table to display cases linked from", 4, "ngIf"], ["id", "show-hide-link", "href", "javascript:void(0)", 1, "govuk-link", 3, "click"], ["aria-describedby", "table to display cases linked from"], [1, "govuk-table__head"], [1, "govuk-table__row"], ["scope", "col", "width", "20%", 1, "govuk-table__header", "case-table-column"], ["class", "govuk-table__body", 4, "ngIf"], [1, "govuk-table__body"], ["class", "govuk-table__row", 4, "ngFor", "ngForOf"], ["class", "govuk-table__row", 4, "ngIf"], [1, "govuk-table__header", "case-table-column", "width-20"], [1, "govuk-body"], ["target", "_blank", "rel", "noopener", 1, "govuk-link", 3, "href"], [1, "case-table-column"], [3, "title"], ["class", "case-table-column", 4, "ngFor", "ngForOf"], [4, "ngFor", "ngForOf"], ["colspan", "5", 1, "govuk-table__cell"]], template: function LinkedCasesFromTableComponent_Template(rf, ctx) { if (rf & 1) {
16897
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LinkedCasesFromTableComponent, selectors: [["ccd-linked-cases-from-table"]], inputs: { caseField: "caseField" }, outputs: { notifyAPIFailure: "notifyAPIFailure" }, decls: 2, vars: 2, consts: [["id", "show-hide-link", "class", "govuk-link", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], ["aria-describedby", "table to display cases linked from", 4, "ngIf"], ["id", "show-hide-link", "href", "javascript:void(0)", 1, "govuk-link", 3, "click"], ["aria-describedby", "table to display cases linked from"], [1, "govuk-table__head"], [1, "govuk-table__row"], ["scope", "col", "width", "20%", 1, "govuk-table__header", "case-table-column"], ["class", "govuk-table__body", 4, "ngIf"], [1, "govuk-table__body"], ["class", "govuk-table__row", 4, "ngFor", "ngForOf"], ["class", "govuk-table__row", 4, "ngIf"], [1, "govuk-table__header", "case-table-column", "width-20"], [1, "govuk-body"], ["target", "_blank", "rel", "noopener", 1, "govuk-link", 3, "href"], [1, "case-table-column"], [3, "title"], ["class", "case-table-column", 4, "ngFor", "ngForOf"], [4, "ngFor", "ngForOf"], ["class", "govuk-!-padding-left-1", 3, "href", 4, "ngIf"], [4, "ngIf"], [1, "govuk-!-padding-left-1", 3, "href"], ["colspan", "5", 1, "govuk-table__cell"]], template: function LinkedCasesFromTableComponent_Template(rf, ctx) { if (rf & 1) {
16855
16898
  i0.ɵɵtemplate(0, LinkedCasesFromTableComponent_a_0_Template, 2, 1, "a", 0)(1, LinkedCasesFromTableComponent_table_1_Template, 14, 1, "table", 1);
16856
16899
  } if (rf & 2) {
16857
16900
  i0.ɵɵproperty("ngIf", !ctx.noLinkedCases && !ctx.isServerError);
@@ -16861,7 +16904,7 @@ class LinkedCasesFromTableComponent {
16861
16904
  }
16862
16905
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LinkedCasesFromTableComponent, [{
16863
16906
  type: Component,
16864
- args: [{ selector: 'ccd-linked-cases-from-table', template: "<a *ngIf=\"!noLinkedCases && !isServerError\" id=\"show-hide-link\" class=\"govuk-link\" href=\"javascript:void(0)\"\n (click)=\"onClick()\">{{showHideLinkText}}</a>\n<table *ngIf=\"(getLinkedCasesResponse && showHideLinkText === 'Hide') || noLinkedCases\"\n aria-describedby=\"table to display cases linked from\">\n <thead class=\"govuk-table__head\">\n <tr class=\"govuk-table__row\">\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Case name and number</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Case type </th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Service</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">State</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Reasons for case link</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\" *ngIf=\"getLinkedCasesResponse && (!isServerError && !isServerReasonCodeError)\">\n <tr class=\"govuk-table__row\" *ngFor=\"let case of getLinkedCasesResponse\">\n <td class=\"govuk-table__header case-table-column width-20\">\n <p class=\"govuk-body\"><a target=\"_blank\" class=\"govuk-link\" href=\"cases/case-details/{{case.caseReference}}\"\n rel=\"noopener\"><span>{{case.caseNameHmctsInternal}} <br>\n {{case.caseReference | ccdCaseReference}}</span></a></p>\n </td>\n <td class=\"case-table-column\"><span [title]=\"case.ccdCaseTypeDescription\">{{case.ccdCaseType}}</span></td>\n <td class=\"case-table-column\"><span>{{case.ccdJurisdiction}}</span></td>\n <td class=\"case-table-column\"><span [title]=\"case.stateDescription\">{{case.state}}</span></td>\n <td class=\"case-table-column\" *ngFor=\"let details of case.linkDetails\">\n <span *ngFor=\"let reason of details.reasons; let i = index; let isLast = last\">\n {{reason | ccdLinkCasesFromReasonValue}} <br>\n </span>\n </td>\n </tr>\n <tr class=\"govuk-table__row\" *ngIf=\"noLinkedCases\">\n <td class=\"govuk-table__cell\" colspan=\"5\">\n None\n </td>\n </tr>\n </tbody> \n</table>\n", styles: [".case-table-column{min-width:20%;max-width:20%}.heading-h2{margin-bottom:0}\n"] }]
16907
+ args: [{ selector: 'ccd-linked-cases-from-table', template: "<a *ngIf=\"!noLinkedCases && !isServerError\" id=\"show-hide-link\" class=\"govuk-link\" href=\"javascript:void(0)\"\n (click)=\"onClick()\">{{showHideLinkText}}</a>\n<table *ngIf=\"(getLinkedCasesResponse && showHideLinkText === 'Hide') || noLinkedCases\"\n aria-describedby=\"table to display cases linked from\">\n <thead class=\"govuk-table__head\">\n <tr class=\"govuk-table__row\">\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Case name and number</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Case type </th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Service</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">State</th>\n <th scope=\"col\" class=\"govuk-table__header case-table-column\" width=\"20%\">Reasons for case link</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\" *ngIf=\"getLinkedCasesResponse && (!isServerError && !isServerReasonCodeError)\">\n <tr class=\"govuk-table__row\" *ngFor=\"let case of getLinkedCasesResponse\">\n <td class=\"govuk-table__header case-table-column width-20\">\n <p class=\"govuk-body\"><a target=\"_blank\" class=\"govuk-link\" href=\"cases/case-details/{{case.caseReference}}\"\n rel=\"noopener\"><span>{{case.caseNameHmctsInternal}} <br>\n {{case.caseReference | ccdCaseReference}}</span></a></p>\n </td>\n <td class=\"case-table-column\"><span [title]=\"case.ccdCaseTypeDescription\">{{case.ccdCaseType}}</span></td>\n <td class=\"case-table-column\"><span>{{case.ccdJurisdiction}}</span></td>\n <td class=\"case-table-column\"><span [title]=\"case.stateDescription\">{{case.state}}</span></td>\n <td class=\"case-table-column\" *ngFor=\"let details of case.linkDetails\">\n <span *ngFor=\"let reason of details.reasons; let i = index; let isLast = last\">\n {{reason | ccdLinkCasesFromReasonValue}}<span><a class=\"govuk-!-padding-left-1\"\n href=\"cases/case-details/{{ case.caseReference }}\"\n *ngIf=\"hasLeadCaseOrConsolidated(reason.reasonCode)\">{{getCaseReferenceLink(case.caseReference)}}</a></span>\n <br *ngIf=\"!isLast\" />\n </span>\n </td>\n </tr>\n <tr class=\"govuk-table__row\" *ngIf=\"noLinkedCases\">\n <td class=\"govuk-table__cell\" colspan=\"5\">\n None\n </td>\n </tr>\n </tbody> \n</table>\n", styles: [".case-table-column{min-width:20%;max-width:20%}.heading-h2{margin-bottom:0}\n"] }]
16865
16908
  }], () => [{ type: i1$1.ActivatedRoute }, { type: CasesService }, { type: LinkedCasesService }], { caseField: [{
16866
16909
  type: Input
16867
16910
  }], notifyAPIFailure: [{
@@ -17771,20 +17814,20 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
17771
17814
  getLinkedCaseReasons(serviceId) {
17772
17815
  const reasonCodeAPIurl = `${this.appConfig.getRDCommonDataApiUrl()}/lov/categories/CaseLinkingReasonCode?serviceId=${serviceId}`;
17773
17816
  this.commonDataService.getRefData(reasonCodeAPIurl).subscribe({
17774
- next: reasons => {
17817
+ next: (reasons) => {
17775
17818
  // Sort in ascending order
17776
17819
  const linkCaseReasons = reasons.list_of_values.sort((a, b) => (a.value_en > b.value_en) ? 1 : -1);
17777
- this.linkedCasesService.linkCaseReasons = linkCaseReasons?.filter(reason => reason.value_en !== 'Other');
17820
+ this.linkedCasesService.linkCaseReasons = linkCaseReasons?.filter((reason) => reason.value_en !== 'Other');
17778
17821
  // Move Other option to the end of the list
17779
- this.linkedCasesService.linkCaseReasons.push(linkCaseReasons?.find(reason => reason.value_en === 'Other'));
17822
+ this.linkedCasesService.linkCaseReasons.push(linkCaseReasons?.find((reason) => reason.value_en === 'Other'));
17780
17823
  }
17781
17824
  });
17782
17825
  }
17783
17826
  getOrgService() {
17784
17827
  const servicesApiUrl = `refdata/location/orgServices?ccdCaseType=${this.caseDetails?.case_type?.id}`;
17785
- this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe(result => {
17786
- result.forEach(ids => {
17787
- this.getLinkedCaseReasons(ids.service_id);
17828
+ this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe((result) => {
17829
+ result.forEach((ids) => {
17830
+ this.getLinkedCaseReasons(ids.service_code);
17788
17831
  });
17789
17832
  });
17790
17833
  }
@@ -32499,8 +32542,8 @@ class CaseFullAccessViewComponent {
32499
32542
  else {
32500
32543
  // sort with the order of CCD predefined tabs
32501
32544
  this.caseDetails.tabs.sort((aTab, bTab) => aTab.order > bTab.order ? 1 : (bTab.order > aTab.order ? -1 : 0));
32502
- // preselect the 1st order of CCD predefined tabs
32503
- const preSelectTab = this.caseDetails.tabs[0];
32545
+ // select the first tab checking if the tab is visible
32546
+ const preSelectTab = this.findPreSelectedActiveTab();
32504
32547
  this.router.navigate(['cases', 'case-details', this.caseDetails.case_id], { fragment: preSelectTab.label }).then(() => {
32505
32548
  matTab = this.tabGroup._tabs.find((x) => x.textLabel === preSelectTab.label);
32506
32549
  // Update selectedIndex only if matTab.position is a non-zero number (positive or negative); this means the
@@ -32531,6 +32574,11 @@ class CaseFullAccessViewComponent {
32531
32574
  }
32532
32575
  }
32533
32576
  }
32577
+ findPreSelectedActiveTab() {
32578
+ const unOrderedTabsInSortedTabs = this.caseDetails.tabs
32579
+ .filter((tab) => !tab.order && this.sortedTabs.some((sortedTab) => sortedTab.id === tab.id));
32580
+ return unOrderedTabsInSortedTabs.length ? unOrderedTabsInSortedTabs[0] : this.sortedTabs[0];
32581
+ }
32534
32582
  // Refactored under EXUI-110 to address infinite tab loop to use tabIndexChanged instead
32535
32583
  tabChanged(tabIndexChanged) {
32536
32584
  const matTab = this.tabGroup._tabs.find(tab => tab.isActive);