@hmcts/ccd-case-ui-toolkit 7.1.80-welsh-translation → 7.1.80

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 (18) hide show
  1. package/esm2022/lib/shared/components/palette/collection/write-collection-field.component.mjs +13 -17
  2. package/esm2022/lib/shared/components/palette/document/write-document-field.component.mjs +2 -2
  3. package/esm2022/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.mjs +25 -2
  4. package/esm2022/lib/shared/components/palette/palette.module.mjs +2 -2
  5. package/esm2022/lib/shared/components/search-filters/search-filters.component.mjs +41 -24
  6. package/esm2022/lib/shared/components/workbasket-filters/workbasket-filters.component.mjs +29 -3
  7. package/esm2022/lib/shared/services/jurisdiction/jurisdiction.service.mjs +6 -3
  8. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +112 -47
  9. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  10. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts +1 -0
  11. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts.map +1 -1
  12. package/lib/shared/components/search-filters/search-filters.component.d.ts +1 -0
  13. package/lib/shared/components/search-filters/search-filters.component.d.ts.map +1 -1
  14. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts +2 -0
  15. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts.map +1 -1
  16. package/lib/shared/services/jurisdiction/jurisdiction.service.d.ts +2 -1
  17. package/lib/shared/services/jurisdiction/jurisdiction.service.d.ts.map +1 -1
  18. package/package.json +1 -1
@@ -57,7 +57,7 @@ import * as i2$2 from 'ngx-pagination';
57
57
  import { NgxPaginationModule, PaginatePipe } from 'ngx-pagination';
58
58
  import * as i10 from '@angular/material/legacy-tabs';
59
59
  import { MatLegacyTabsModule } from '@angular/material/legacy-tabs';
60
- import { decompressFromUTF16, compressToUTF16 } from 'lz-string';
60
+ import { compressToUTF16, decompressFromUTF16 } from 'lz-string';
61
61
 
62
62
  const _c0$16 = [[["", "footerSolsNavLinks", ""]], [["", "footerCaseWorkerNavLinks", ""]]];
63
63
  const _c1$u = ["[footerSolsNavLinks]", "[footerCaseWorkerNavLinks]"];
@@ -7422,7 +7422,7 @@ class JurisdictionService {
7422
7422
  httpService;
7423
7423
  // We retain the Subject observable because subscribing code couldn't happen a null value
7424
7424
  selectedJurisdictionSource = new Subject();
7425
- selectedJurisdictionBS = new BehaviorSubject(null);
7425
+ _selectedJurisdictionBS = new BehaviorSubject(null);
7426
7426
  selectedJurisdiction;
7427
7427
  constructor(httpService) {
7428
7428
  this.httpService = httpService;
@@ -7433,7 +7433,10 @@ class JurisdictionService {
7433
7433
  }
7434
7434
  announceSelectedJurisdiction(jurisdiction) {
7435
7435
  this.selectedJurisdictionSource.next(jurisdiction);
7436
- this.selectedJurisdictionBS.next(jurisdiction);
7436
+ this._selectedJurisdictionBS.next(jurisdiction);
7437
+ }
7438
+ getSelectedJurisdiction() {
7439
+ return this._selectedJurisdictionBS;
7437
7440
  }
7438
7441
  searchJudicialUsers(searchTerm, serviceId) {
7439
7442
  return this.httpService.post('api/prd/judicial/getJudicialUsersSearch', { searchString: searchTerm, serviceCode: serviceId });
@@ -14364,18 +14367,14 @@ function WriteCollectionFieldComponent_h2_8_span_1_Template(rf, ctx) { if (rf &
14364
14367
  i0.ɵɵelementStart(0, "span", 10)(1, "markdown");
14365
14368
  i0.ɵɵtext(2);
14366
14369
  i0.ɵɵpipe(3, "rpxTranslate");
14367
- i0.ɵɵelementEnd();
14368
- i0.ɵɵelement(4, "ccd-markdown", 11);
14369
- i0.ɵɵelementEnd();
14370
+ i0.ɵɵelementEnd()();
14370
14371
  } if (rf & 2) {
14371
14372
  const ctx_r0 = i0.ɵɵnextContext(2);
14372
14373
  i0.ɵɵadvance(2);
14373
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, ctx_r0.caseField.hint_text));
14374
- i0.ɵɵadvance(2);
14375
- i0.ɵɵproperty("content", ctx_r0.caseField.hint_text);
14374
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 1, ctx_r0.caseField.hint_text));
14376
14375
  } }
14377
14376
  function WriteCollectionFieldComponent_h2_8_span_2_Template(rf, ctx) { if (rf & 1) {
14378
- i0.ɵɵelementStart(0, "span", 12);
14377
+ i0.ɵɵelementStart(0, "span", 11);
14379
14378
  i0.ɵɵtext(1);
14380
14379
  i0.ɵɵpipe(2, "ccdFirstError");
14381
14380
  i0.ɵɵelementEnd();
@@ -14386,7 +14385,7 @@ function WriteCollectionFieldComponent_h2_8_span_2_Template(rf, ctx) { if (rf &
14386
14385
  } }
14387
14386
  function WriteCollectionFieldComponent_h2_8_Template(rf, ctx) { if (rf & 1) {
14388
14387
  i0.ɵɵelementStart(0, "h2", 3);
14389
- i0.ɵɵtemplate(1, WriteCollectionFieldComponent_h2_8_span_1_Template, 5, 4, "span", 8)(2, WriteCollectionFieldComponent_h2_8_span_2_Template, 3, 4, "span", 9);
14388
+ i0.ɵɵtemplate(1, WriteCollectionFieldComponent_h2_8_span_1_Template, 4, 3, "span", 8)(2, WriteCollectionFieldComponent_h2_8_span_2_Template, 3, 4, "span", 9);
14390
14389
  i0.ɵɵelementEnd();
14391
14390
  } if (rf & 2) {
14392
14391
  const ctx_r0 = i0.ɵɵnextContext();
@@ -14397,16 +14396,16 @@ function WriteCollectionFieldComponent_h2_8_Template(rf, ctx) { if (rf & 1) {
14397
14396
  } }
14398
14397
  function WriteCollectionFieldComponent_div_9_div_2_Template(rf, ctx) { if (rf & 1) {
14399
14398
  const _r2 = i0.ɵɵgetCurrentView();
14400
- i0.ɵɵelementStart(0, "div", 1, 0)(2, "div", 16)(3, "div", 17)(4, "legend", 18)(5, "label", 19)(6, "h3", 20);
14399
+ i0.ɵɵelementStart(0, "div", 1, 0)(2, "div", 15)(3, "div", 16)(4, "legend", 17)(5, "label", 18)(6, "h3", 19);
14401
14400
  i0.ɵɵtext(7);
14402
14401
  i0.ɵɵpipe(8, "rpxTranslate");
14403
14402
  i0.ɵɵelementEnd()()()();
14404
- i0.ɵɵelementStart(9, "div", 21)(10, "button", 22);
14403
+ i0.ɵɵelementStart(9, "div", 20)(10, "button", 21);
14405
14404
  i0.ɵɵlistener("click", function WriteCollectionFieldComponent_div_9_div_2_Template_button_click_10_listener() { const i_r3 = i0.ɵɵrestoreView(_r2).index; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.openModal(i_r3)); });
14406
14405
  i0.ɵɵtext(11);
14407
14406
  i0.ɵɵpipe(12, "rpxTranslate");
14408
14407
  i0.ɵɵelementEnd()()();
14409
- i0.ɵɵelement(13, "ccd-field-write", 23);
14408
+ i0.ɵɵelement(13, "ccd-field-write", 22);
14410
14409
  i0.ɵɵelementEnd();
14411
14410
  } if (rf & 2) {
14412
14411
  const item_r4 = ctx.$implicit;
@@ -14426,8 +14425,8 @@ function WriteCollectionFieldComponent_div_9_div_2_Template(rf, ctx) { if (rf &
14426
14425
  i0.ɵɵproperty("caseField", item_r4.caseField)("caseFields", ctx_r0.caseFields)("formGroup", ctx_r0.formGroup)("parent", item_r4.container)("idPrefix", item_r4.prefix)("hidden", item_r4.caseField.hidden)("isExpanded", ctx_r0.isExpanded)("isInSearchBlock", ctx_r0.isInSearchBlock);
14427
14426
  } }
14428
14427
  function WriteCollectionFieldComponent_div_9_Template(rf, ctx) { if (rf & 1) {
14429
- i0.ɵɵelementStart(0, "div", 13)(1, "fieldset", 14);
14430
- i0.ɵɵtemplate(2, WriteCollectionFieldComponent_div_9_div_2_Template, 14, 19, "div", 15);
14428
+ i0.ɵɵelementStart(0, "div", 12)(1, "fieldset", 13);
14429
+ i0.ɵɵtemplate(2, WriteCollectionFieldComponent_div_9_div_2_Template, 14, 19, "div", 14);
14431
14430
  i0.ɵɵelementEnd()();
14432
14431
  } if (rf & 2) {
14433
14432
  const ctx_r0 = i0.ɵɵnextContext();
@@ -14437,7 +14436,7 @@ function WriteCollectionFieldComponent_div_9_Template(rf, ctx) { if (rf & 1) {
14437
14436
  } }
14438
14437
  function WriteCollectionFieldComponent_button_10_Template(rf, ctx) { if (rf & 1) {
14439
14438
  const _r5 = i0.ɵɵgetCurrentView();
14440
- i0.ɵɵelementStart(0, "button", 24);
14439
+ i0.ɵɵelementStart(0, "button", 23);
14441
14440
  i0.ɵɵlistener("click", function WriteCollectionFieldComponent_button_10_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.addItem(false)); });
14442
14441
  i0.ɵɵtext(1);
14443
14442
  i0.ɵɵpipe(2, "rpxTranslate");
@@ -14755,7 +14754,7 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
14755
14754
  } if (rf & 2) {
14756
14755
  let _t;
14757
14756
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.items = _t);
14758
- } }, inputs: { caseFields: "caseFields" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 11, consts: [["collectionItem", ""], [1, "form-group", 3, "id"], [1, "panel", "collection-indicator"], [1, "heading-h2", "error-spacing"], ["type", "button", 1, "button", "write-collection-add-item__top", 3, "click", "disabled"], ["class", "heading-h2 error-spacing", 4, "ngIf"], ["class", "form-group", 3, "hidden", 4, "ngIf"], ["class", "button write-collection-add-item__bottom", "type", "button", 3, "disabled", "click", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [1, "form-hint"], [3, "content"], [1, "error-message"], [1, "form-group", 3, "hidden"], [1, "govuk-fieldset"], ["class", "form-group", 3, "id", 4, "ngFor", "ngForOf"], [1, "collection-title"], [1, "float-left"], [1, "govuk-fieldset__legend"], [3, "for"], [1, "heading-h3"], [1, "float-right"], ["type", "button", 1, "button", "button-secondary", 3, "click", "disabled"], [3, "caseField", "caseFields", "formGroup", "parent", "idPrefix", "hidden", "isExpanded", "isInSearchBlock"], ["type", "button", 1, "button", "write-collection-add-item__bottom", 3, "click", "disabled"]], template: function WriteCollectionFieldComponent_Template(rf, ctx) { if (rf & 1) {
14757
+ } }, inputs: { caseFields: "caseFields" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 11, consts: [["collectionItem", ""], [1, "form-group", 3, "id"], [1, "panel", "collection-indicator"], [1, "heading-h2", "error-spacing"], ["type", "button", 1, "button", "write-collection-add-item__top", 3, "click", "disabled"], ["class", "heading-h2 error-spacing", 4, "ngIf"], ["class", "form-group", 3, "hidden", 4, "ngIf"], ["class", "button write-collection-add-item__bottom", "type", "button", 3, "disabled", "click", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [1, "form-hint"], [1, "error-message"], [1, "form-group", 3, "hidden"], [1, "govuk-fieldset"], ["class", "form-group", 3, "id", 4, "ngFor", "ngForOf"], [1, "collection-title"], [1, "float-left"], [1, "govuk-fieldset__legend"], [3, "for"], [1, "heading-h3"], [1, "float-right"], ["type", "button", 1, "button", "button-secondary", 3, "click", "disabled"], [3, "caseField", "caseFields", "formGroup", "parent", "idPrefix", "hidden", "isExpanded", "isInSearchBlock"], ["type", "button", 1, "button", "write-collection-add-item__bottom", 3, "click", "disabled"]], template: function WriteCollectionFieldComponent_Template(rf, ctx) { if (rf & 1) {
14759
14758
  i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "h2", 3);
14760
14759
  i0.ɵɵtext(3);
14761
14760
  i0.ɵɵpipe(4, "ccdFieldLabel");
@@ -14785,7 +14784,7 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
14785
14784
  }
14786
14785
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteCollectionFieldComponent, [{
14787
14786
  type: Component,
14788
- args: [{ selector: 'ccd-write-collection-field', template: "<div class=\"form-group\" [id]=\"id()\">\n\n <div class=\"panel collection-indicator\">\n\n <h2 class=\"heading-h2 error-spacing\">\n {{(caseField | ccdFieldLabel)}}\n </h2>\n <button class=\"button write-collection-add-item__top\" type=\"button\" (click)=\"addItem(true)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\">{{'Add new' | rpxTranslate}}</button>\n <h2 class=\"heading-h2 error-spacing\" *ngIf=\"caseField.hint_text || formArray.errors\">\n <span *ngIf=\"caseField.hint_text\" class=\"form-hint\">\n <markdown>{{caseField.hint_text | rpxTranslate }}</markdown>\n <ccd-markdown [content]=\"caseField.hint_text\"></ccd-markdown>\n </span>\n <span *ngIf=\"formArray.errors\" class=\"error-message\">\n {{(formArray.errors | ccdFirstError:caseField.label)}}\n </span>\n </h2>\n\n <div class=\"form-group\" [hidden]=\"caseField.hidden\" *ngIf=\"caseField.value && caseField.value.length\">\n <fieldset class=\"govuk-fieldset\">\n <div *ngFor=\"let item of collItems; let i = index\" #collectionItem\n [id]=\"this.buildIdPrefix(i) + i\" class=\"form-group\">\n <div class=\"collection-title\">\n <div class=\"float-left\">\n <legend class=\"govuk-fieldset__legend\">\n <label [for]=\"item.prefix + i\"><h3 class=\"heading-h3\">{{itemLabel(i) | rpxTranslate}}</h3></label>\n </legend>\n </div>\n <div class=\"float-right\">\n <button class=\"button button-secondary\" type=\"button\" (click)=\"openModal(i)\"\n [disabled]=\"isNotAuthorisedToDelete(i)\"\n attr.aria-label=\"Remove {{ itemLabel(i) }}\">{{'Remove' | rpxTranslate}}</button>\n </div>\n </div>\n <ccd-field-write [caseField]=\"item.caseField\"\n [caseFields]=\"caseFields\"\n [formGroup]=\"formGroup\"\n [parent]=\"item.container\"\n [idPrefix]=\"item.prefix\"\n [hidden]=\"item.caseField.hidden\"\n [isExpanded]=\"isExpanded\"\n [isInSearchBlock]=\"isInSearchBlock\">\n </ccd-field-write>\n </div>\n </fieldset>\n </div>\n\n <button class=\"button write-collection-add-item__bottom\" type=\"button\" (click)=\"addItem(false)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\" *ngIf=\"caseField.value && caseField.value.length\">{{'Add new' | rpxTranslate }}</button>\n\n </div>\n\n</div>\n", styles: [".collection-field-table tr:first-child>td{padding-top:0}.collection-field-table tr:last-child>td{border-bottom:none}.collection-field-table td.collection-actions{width:1px;white-space:nowrap}.error-spacing{margin-top:10px}.collection-title{height:51px}.float-left{float:left;padding-top:8px}.float-right{float:right}.complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}.collection-indicator{border-left:solid 5px #b1b4b6}\n"] }]
14787
+ args: [{ selector: 'ccd-write-collection-field', template: "<div class=\"form-group\" [id]=\"id()\">\n\n <div class=\"panel collection-indicator\">\n\n <h2 class=\"heading-h2 error-spacing\">\n {{(caseField | ccdFieldLabel)}}\n </h2>\n <button class=\"button write-collection-add-item__top\" type=\"button\" (click)=\"addItem(true)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\">{{'Add new' | rpxTranslate}}</button>\n <h2 class=\"heading-h2 error-spacing\" *ngIf=\"caseField.hint_text || formArray.errors\">\n <span *ngIf=\"caseField.hint_text\" class=\"form-hint\">\n <markdown>{{caseField.hint_text | rpxTranslate }}</markdown>\n </span>\n <span *ngIf=\"formArray.errors\" class=\"error-message\">\n {{(formArray.errors | ccdFirstError:caseField.label)}}\n </span>\n </h2>\n\n <div class=\"form-group\" [hidden]=\"caseField.hidden\" *ngIf=\"caseField.value && caseField.value.length\">\n <fieldset class=\"govuk-fieldset\">\n <div *ngFor=\"let item of collItems; let i = index\" #collectionItem\n [id]=\"this.buildIdPrefix(i) + i\" class=\"form-group\">\n <div class=\"collection-title\">\n <div class=\"float-left\">\n <legend class=\"govuk-fieldset__legend\">\n <label [for]=\"item.prefix + i\"><h3 class=\"heading-h3\">{{itemLabel(i) | rpxTranslate}}</h3></label>\n </legend>\n </div>\n <div class=\"float-right\">\n <button class=\"button button-secondary\" type=\"button\" (click)=\"openModal(i)\"\n [disabled]=\"isNotAuthorisedToDelete(i)\"\n attr.aria-label=\"Remove {{ itemLabel(i) }}\">{{'Remove' | rpxTranslate}}</button>\n </div>\n </div>\n <ccd-field-write [caseField]=\"item.caseField\"\n [caseFields]=\"caseFields\"\n [formGroup]=\"formGroup\"\n [parent]=\"item.container\"\n [idPrefix]=\"item.prefix\"\n [hidden]=\"item.caseField.hidden\"\n [isExpanded]=\"isExpanded\"\n [isInSearchBlock]=\"isInSearchBlock\">\n </ccd-field-write>\n </div>\n </fieldset>\n </div>\n\n <button class=\"button write-collection-add-item__bottom\" type=\"button\" (click)=\"addItem(false)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\" *ngIf=\"caseField.value && caseField.value.length\">{{'Add new' | rpxTranslate }}</button>\n\n </div>\n\n</div>\n", styles: [".collection-field-table tr:first-child>td{padding-top:0}.collection-field-table tr:last-child>td{border-bottom:none}.collection-field-table td.collection-actions{width:1px;white-space:nowrap}.error-spacing{margin-top:10px}.collection-title{height:51px}.float-left{float:left;padding-top:8px}.float-right{float:right}.complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}.collection-indicator{border-left:solid 5px #b1b4b6}\n"] }]
14789
14788
  }], () => [{ type: i1$3.MatLegacyDialog }, { type: i2.ScrollToService }, { type: ProfileNotifier }, { type: i0.ChangeDetectorRef }], { caseFields: [{
14790
14789
  type: Input
14791
14790
  }], items: [{
@@ -15265,7 +15264,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15265
15264
  this.jurisdictionId = caseDetails?.case_type?.jurisdiction?.id;
15266
15265
  }
15267
15266
  });
15268
- this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
15267
+ this.jurisdictionSubs = this.jurisdictionService.getSelectedJurisdiction().subscribe({
15269
15268
  next: (jurisdiction) => {
15270
15269
  if (jurisdiction) {
15271
15270
  this.jurisdictionId = jurisdiction.id;
@@ -16583,6 +16582,7 @@ class WriteJudicialUserFieldComponent extends WriteComplexFieldComponent {
16583
16582
  invalidSearchTerm = false;
16584
16583
  judicialUserSelected = false;
16585
16584
  jurisdictionSubscription;
16585
+ notifierSubscription;
16586
16586
  constructor(jurisdictionService, sessionStorageService, caseFlagRefDataService, compoundPipe, validatorsService, caseNotifier) {
16587
16587
  super(compoundPipe, validatorsService);
16588
16588
  this.jurisdictionService = jurisdictionService;
@@ -16591,7 +16591,17 @@ class WriteJudicialUserFieldComponent extends WriteComplexFieldComponent {
16591
16591
  this.compoundPipe = compoundPipe;
16592
16592
  this.validatorsService = validatorsService;
16593
16593
  this.caseNotifier = caseNotifier;
16594
- this.caseNotifier.caseView.subscribe((caseDetails) => {
16594
+ // We need to caseType from the case list filters as well as the case notifier, because the judicial user component
16595
+ // can be used in the case list before any case is opened, thus the caseNotifier has nothing to notify
16596
+ this.jurisdictionSubscription = this.jurisdictionService.getSelectedJurisdiction()?.subscribe({
16597
+ next: (jurisdiction) => {
16598
+ if (jurisdiction?.currentCaseType) {
16599
+ this.jurisdiction = jurisdiction.id;
16600
+ this.caseType = jurisdiction.currentCaseType.id;
16601
+ }
16602
+ }
16603
+ });
16604
+ this.notifierSubscription = this.caseNotifier.caseView.subscribe((caseDetails) => {
16595
16605
  if (caseDetails) {
16596
16606
  this.jurisdiction = caseDetails?.case_type?.jurisdiction?.id;
16597
16607
  this.caseType = caseDetails?.case_type?.id;
@@ -16624,6 +16634,17 @@ class WriteJudicialUserFieldComponent extends WriteComplexFieldComponent {
16624
16634
  }
16625
16635
  }
16626
16636
  filterJudicialUsers(searchTerm) {
16637
+ if (!this.caseType) {
16638
+ this.caseType = this.jurisdictionService.getSelectedJurisdiction()?.getValue()?.currentCaseType?.id;
16639
+ }
16640
+ // we need to identify the "base case type" for the service code, because services tend to create testing
16641
+ // case types that aren't present in ref data. Generally these are called <casetype>-<something>. There are no
16642
+ // real case types that include a hyphen in the name (I've checked the ref data),
16643
+ // so we can use this to identify the base case type
16644
+ // and strip off the suffix. This is a bit of a hack, but it works for now.
16645
+ if (this.caseType && this.caseType.includes('-')) {
16646
+ this.caseType = this.caseType.split('-')[0];
16647
+ }
16627
16648
  return this.caseFlagRefDataService.getHmctsServiceDetailsByCaseType(this.caseType).pipe(
16628
16649
  // If an error occurs retrieving HMCTS service details by case type ID, try by service name instead
16629
16650
  catchError(_ => this.caseFlagRefDataService.getHmctsServiceDetailsByServiceName(this.jurisdiction)),
@@ -16689,6 +16710,7 @@ class WriteJudicialUserFieldComponent extends WriteComplexFieldComponent {
16689
16710
  }
16690
16711
  ngOnDestroy() {
16691
16712
  this.jurisdictionSubscription?.unsubscribe();
16713
+ this.notifierSubscription?.unsubscribe();
16692
16714
  }
16693
16715
  static ɵfac = function WriteJudicialUserFieldComponent_Factory(t) { return new (t || WriteJudicialUserFieldComponent)(i0.ɵɵdirectiveInject(JurisdictionService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseFlagRefdataService), i0.ɵɵdirectiveInject(IsCompoundPipe), i0.ɵɵdirectiveInject(FormValidatorsService), i0.ɵɵdirectiveInject(CaseNotifier)); };
16694
16716
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteJudicialUserFieldComponent, selectors: [["ccd-write-judicial-user-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 17, consts: [["autoComplete", "matAutocomplete"], [1, "form-group", 3, "formGroup", "ngClass"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [1, "form-control", "bottom-30", 3, "blur", "id", "formControl", "matAutocomplete"], ["autoActiveFirstOption", "", 3, "displayWith"], ["class", "select-option", 3, "ngClass", "value", "onSelectionChange", 4, "ngFor", "ngForOf"], ["class", "select-option", "disabled", "", 4, "ngIf"], [1, "form-label"], [1, "form-hint"], [1, "error-message"], [1, "select-option", 3, "onSelectionChange", "ngClass", "value"], ["disabled", "", 1, "select-option"]], template: function WriteJudicialUserFieldComponent_Template(rf, ctx) { if (rf & 1) {
@@ -30664,7 +30686,7 @@ i0.ɵɵsetComponentScope(WriteOrganisationFieldComponent, function () { return [
30664
30686
  i0.ɵɵsetComponentScope(WriteOrderSummaryFieldComponent, function () { return [ReadOrderSummaryFieldComponent]; }, []);
30665
30687
  i0.ɵɵsetComponentScope(WriteDateContainerFieldComponent, function () { return [i5.NgIf, i4.NgControlStatusGroup, i4.FormGroupDirective, DatetimePickerComponent,
30666
30688
  WriteDateFieldComponent]; }, []);
30667
- i0.ɵɵsetComponentScope(WriteCollectionFieldComponent, function () { return [i5.NgForOf, i5.NgIf, i4.NgControlStatusGroup, i4.FormGroupDirective, i1$4.MarkdownComponent, MarkdownComponent, FieldWriteComponent]; }, function () { return [FieldLabelPipe, FirstErrorPipe, i1.RpxTranslatePipe]; });
30689
+ i0.ɵɵsetComponentScope(WriteCollectionFieldComponent, function () { return [i5.NgForOf, i5.NgIf, i4.NgControlStatusGroup, i4.FormGroupDirective, i1$4.MarkdownComponent, FieldWriteComponent]; }, function () { return [FieldLabelPipe, FirstErrorPipe, i1.RpxTranslatePipe]; });
30668
30690
  i0.ɵɵsetComponentScope(
30669
30691
  // ComponentLauncher web components
30670
30692
  CaseFileViewFieldComponent, function () { return [i5.NgForOf, i5.NgIf, i14.MediaViewerComponent, CaseFileViewFolderComponent]; }, []);
@@ -32636,8 +32658,32 @@ class WorkbasketFiltersComponent {
32636
32658
  this.alertService = alertService;
32637
32659
  this.windowService = windowService;
32638
32660
  }
32661
+ getDefaultJurisdiction() {
32662
+ if (!this.jurisdictions || this.jurisdictions.length === 0) {
32663
+ return null;
32664
+ }
32665
+ return this.defaults.jurisdiction_id
32666
+ ? this.jurisdictions.find(j => this.defaults.jurisdiction_id === j.id)
32667
+ : this.jurisdictions[0];
32668
+ }
32669
+ getDefaultCaseType() {
32670
+ return this.defaults.case_type_id
32671
+ ? this.getDefaultJurisdiction()?.caseTypes.find(ct => this.defaults.case_type_id === ct.id)
32672
+ : this.getDefaultJurisdiction()?.caseTypes[0];
32673
+ }
32639
32674
  ngOnInit() {
32640
- this.selected = {};
32675
+ const j = this.getDefaultJurisdiction();
32676
+ const ct = this.getDefaultCaseType();
32677
+ j.currentCaseType = ct;
32678
+ this.selected = {
32679
+ jurisdiction: j,
32680
+ caseType: ct,
32681
+ formGroup: null,
32682
+ caseState: undefined,
32683
+ page: 1,
32684
+ metadataFields: []
32685
+ };
32686
+ this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
32641
32687
  this.route.queryParams.subscribe(params => {
32642
32688
  if (!this.initialised || !params || !Object.keys(params).length) {
32643
32689
  this.initFilters(false);
@@ -32713,7 +32759,8 @@ class WorkbasketFiltersComponent {
32713
32759
  onJurisdictionIdChange() {
32714
32760
  if (this.selected.jurisdiction) {
32715
32761
  this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
32716
- this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes.length > 0 ? this.selected.jurisdiction.caseTypes : null;
32762
+ this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes.length > 0
32763
+ ? this.selected.jurisdiction.caseTypes : null;
32717
32764
  // Line was too long for linting so refactored it.
32718
32765
  if (this.workbasketDefaults && this.selectedJurisdictionCaseTypes) {
32719
32766
  this.selected.caseType = this.selectedJurisdictionCaseTypes[0];
@@ -32836,6 +32883,7 @@ class WorkbasketFiltersComponent {
32836
32883
  }
32837
32884
  else {
32838
32885
  this.selected.jurisdiction = null;
32886
+ this.selected.caseType = null;
32839
32887
  }
32840
32888
  this.apply(init);
32841
32889
  }
@@ -38215,31 +38263,30 @@ class SearchFiltersComponent {
38215
38263
  this.orderService = orderService;
38216
38264
  this.jurisdictionService = jurisdictionService;
38217
38265
  this.windowService = windowService;
38266
+ this.selected = {};
38218
38267
  }
38219
38268
  ngOnInit() {
38220
- this.selected = {};
38221
- const jurisdiction = this.windowService.getLocalStorage(JURISDICTION_LOC_STORAGE);
38269
+ const jurisdiction = this.getValuesFromLocalStorage();
38222
38270
  if (this.jurisdictions.length === 1 || jurisdiction) {
38223
38271
  this.selected.jurisdiction = this.jurisdictions[0];
38224
38272
  if (jurisdiction) {
38225
- try {
38226
- console.log('jurisdiction retrieved from local storage len = ' + jurisdiction.length);
38227
- const localStorageJurisdiction = JSON.parse(decompressFromUTF16(jurisdiction));
38228
- if (localStorageJurisdiction) {
38229
- this.selected.jurisdiction = this.jurisdictions
38230
- .filter(j => j.id === localStorageJurisdiction.id)[0];
38231
- }
38273
+ this.selected.jurisdiction = this.jurisdictions
38274
+ .filter(j => j.id === jurisdiction.id)[0];
38275
+ if (jurisdiction.currentCaseType &&
38276
+ this.selected.jurisdiction.caseTypes.find(ct => ct.id === jurisdiction.currentCaseType.id)) {
38277
+ this.selected.jurisdiction.currentCaseType = jurisdiction.currentCaseType;
38232
38278
  }
38233
- catch (e) {
38234
- console.log("Failed to retrieve jurisdiction from local storage");
38235
- this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
38279
+ else {
38280
+ this.selected.jurisdiction.currentCaseType = this.selected.jurisdiction.caseTypes[0];
38236
38281
  }
38237
38282
  }
38238
38283
  this.onJurisdictionIdChange();
38239
38284
  }
38240
- this.selected.formGroup = this.formGroup;
38241
- this.selected.page = 1;
38242
- this.selected.metadataFields = this.getMetadataFields();
38285
+ if (this.selected) {
38286
+ this.selected.formGroup = this.formGroup;
38287
+ this.selected.page = 1;
38288
+ this.selected.metadataFields = this.getMetadataFields();
38289
+ }
38243
38290
  this.onApply.emit({
38244
38291
  selected: this.selected,
38245
38292
  queryParams: this.getQueryParams()
@@ -38258,7 +38305,6 @@ class SearchFiltersComponent {
38258
38305
  this.onReset.emit();
38259
38306
  }
38260
38307
  apply() {
38261
- console.log("Search filters apply");
38262
38308
  this.selected.formGroup = this.formGroup;
38263
38309
  this.selected.page = 1;
38264
38310
  this.selected.metadataFields = this.getMetadataFields();
@@ -38275,16 +38321,30 @@ class SearchFiltersComponent {
38275
38321
  try {
38276
38322
  const compJurisd = compressToUTF16(JSON.stringify(this.selected.jurisdiction));
38277
38323
  this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, compJurisd);
38278
- console.log('jurisdiction compressed into local storage, length = ' + compJurisd.length);
38279
38324
  }
38280
38325
  catch (e) {
38281
- console.log('Could not store jurisdiction in local storage');
38282
38326
  this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
38283
38327
  }
38284
38328
  if (this.selected.caseType) {
38285
38329
  this.windowService.setLocalStorage(CASE_TYPE_LOC_STORAGE, JSON.stringify(this.selected.caseType));
38286
38330
  }
38287
38331
  }
38332
+ getValuesFromLocalStorage() {
38333
+ const jurisdiction = this.windowService.getLocalStorage(JURISDICTION_LOC_STORAGE);
38334
+ if (jurisdiction) {
38335
+ try {
38336
+ const localStorageJurisdiction = JSON.parse(decompressFromUTF16(jurisdiction));
38337
+ if (localStorageJurisdiction) {
38338
+ return localStorageJurisdiction;
38339
+ }
38340
+ }
38341
+ catch (e) {
38342
+ console.log("Failed to retrieve jurisdiction from local storage");
38343
+ this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
38344
+ }
38345
+ }
38346
+ return null;
38347
+ }
38288
38348
  getMetadataFields() {
38289
38349
  if (this.searchInputs) {
38290
38350
  return this.searchInputs
@@ -38303,12 +38363,16 @@ class SearchFiltersComponent {
38303
38363
  }
38304
38364
  onJurisdictionIdChange() {
38305
38365
  this.selected.caseType = null;
38306
- this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
38307
- this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes;
38366
+ this.selectedJurisdictionCaseTypes = this.selected?.jurisdiction?.caseTypes;
38308
38367
  this.selectCaseType(this.selectedJurisdictionCaseTypes);
38368
+ this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
38309
38369
  this.onJurisdiction.emit(this.selected.jurisdiction);
38310
38370
  }
38311
38371
  onCaseTypeIdChange() {
38372
+ if (this.selected.jurisdiction && this.selected.caseType) {
38373
+ this.selected.jurisdiction.currentCaseType = this.selected.caseType;
38374
+ this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
38375
+ }
38312
38376
  this.formGroup = new FormGroup({});
38313
38377
  this.searchInputsReady = false;
38314
38378
  this.searchInputs = [];
@@ -38340,13 +38404,13 @@ class SearchFiltersComponent {
38340
38404
  getQueryParams() {
38341
38405
  // Save filters as query parameters for current route
38342
38406
  const queryParams = {};
38343
- if (this.selected.jurisdiction) {
38407
+ if (this.selected?.jurisdiction) {
38344
38408
  queryParams[this.PARAM_JURISDICTION] = this.selected.jurisdiction.id;
38345
38409
  }
38346
- if (this.selected.caseType) {
38410
+ if (this.selected?.caseType) {
38347
38411
  queryParams[this.PARAM_CASE_TYPE] = this.selected.caseType.id;
38348
38412
  }
38349
- if (this.selected.caseState) {
38413
+ if (this.selected?.caseState) {
38350
38414
  queryParams[this.PARAM_CASE_STATE] = this.selected.caseState.id;
38351
38415
  }
38352
38416
  return queryParams;
@@ -38368,6 +38432,7 @@ class SearchFiltersComponent {
38368
38432
  else {
38369
38433
  this.selected.caseType = caseTypes[0];
38370
38434
  }
38435
+ this.selected.jurisdiction.currentCaseType = this.selected.caseType;
38371
38436
  this.onCaseTypeIdChange();
38372
38437
  }
38373
38438
  }