@hmcts/ccd-case-ui-toolkit 5.0.46-fix-case-link → 5.0.47-fix-case-link

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.
@@ -116,11 +116,11 @@ function FooterComponent_div_3_Template(rf, ctx) { if (rf & 1) {
116
116
  i0.ɵɵtextInterpolate(ctx_r1.workhours);
117
117
  } }
118
118
  const _c0$_ = [[["", "footerSolsNavLinks", ""]], [["", "footerCaseWorkerNavLinks", ""]]];
119
- const _c1$r = ["[footerSolsNavLinks]", "[footerCaseWorkerNavLinks]"];
119
+ const _c1$s = ["[footerSolsNavLinks]", "[footerCaseWorkerNavLinks]"];
120
120
  class FooterComponent {
121
121
  }
122
122
  FooterComponent.ɵfac = function FooterComponent_Factory(t) { return new (t || FooterComponent)(); };
123
- FooterComponent.ɵcmp = i0.ɵɵdefineComponent({ type: FooterComponent, selectors: [["cut-footer-bar"]], inputs: { email: "email", isSolicitor: "isSolicitor", phone: "phone", workhours: "workhours" }, ngContentSelectors: _c1$r, decls: 4, vars: 4, consts: [["id", "footer", "role", "footer", 1, "group", "js-footer"], [1, "footer-wrapper"], ["class", "footer-meta", 4, "ngIf"], [1, "footer-meta"], [1, "footer-meta-inner"], [1, "open-government-licence"], [1, "logo"], ["href", "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", "rel", "license"], [1, "copyright"], ["href", "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/copyright-and-re-use/crown-copyright/"], [1, "title"], [1, "footer-text"], [1, "email"], [3, "href"], [1, "phone"], [1, "work-hours"]], template: function FooterComponent_Template(rf, ctx) { if (rf & 1) {
123
+ FooterComponent.ɵcmp = i0.ɵɵdefineComponent({ type: FooterComponent, selectors: [["cut-footer-bar"]], inputs: { email: "email", isSolicitor: "isSolicitor", phone: "phone", workhours: "workhours" }, ngContentSelectors: _c1$s, decls: 4, vars: 4, consts: [["id", "footer", "role", "footer", 1, "group", "js-footer"], [1, "footer-wrapper"], ["class", "footer-meta", 4, "ngIf"], [1, "footer-meta"], [1, "footer-meta-inner"], [1, "open-government-licence"], [1, "logo"], ["href", "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", "rel", "license"], [1, "copyright"], ["href", "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/copyright-and-re-use/crown-copyright/"], [1, "title"], [1, "footer-text"], [1, "email"], [3, "href"], [1, "phone"], [1, "work-hours"]], template: function FooterComponent_Template(rf, ctx) { if (rf & 1) {
124
124
  i0.ɵɵprojectionDef(_c0$_);
125
125
  i0.ɵɵelementStart(0, "footer", 0);
126
126
  i0.ɵɵelementStart(1, "div", 1);
@@ -189,7 +189,7 @@ function HeaderBarComponent_div_9_Template(rf, ctx) { if (rf & 1) {
189
189
  i0.ɵɵtextInterpolate(ctx_r2.title);
190
190
  } }
191
191
  const _c0$Z = [[["", "headerNavigation", ""]]];
192
- const _c1$q = ["[headerNavigation]"];
192
+ const _c1$r = ["[headerNavigation]"];
193
193
  class HeaderBarComponent {
194
194
  constructor() {
195
195
  this.signOutRequest = new EventEmitter();
@@ -199,7 +199,7 @@ class HeaderBarComponent {
199
199
  }
200
200
  }
201
201
  HeaderBarComponent.ɵfac = function HeaderBarComponent_Factory(t) { return new (t || HeaderBarComponent)(); };
202
- HeaderBarComponent.ɵcmp = i0.ɵɵdefineComponent({ type: HeaderBarComponent, selectors: [["cut-header-bar"]], inputs: { title: "title", isSolicitor: "isSolicitor", username: "username" }, outputs: { signOutRequest: "signOutRequest" }, ngContentSelectors: _c1$q, decls: 15, vars: 8, consts: [["role", "banner", "id", "global-header", 1, "with-proposition"], [1, "header-wrapper"], [1, "header-global"], [4, "ngIf"], ["class", "global-header", 4, "ngIf"], [1, "header-proposition"], [1, "content"], ["href", "#proposition-links", 1, "js-header-toggle", "menu"], ["id", "proposition-menu", 4, "ngIf"], [1, "proposition-right"], ["id", "user-name"], ["id", "sign-out", "href", "javascript:void(0)", 3, "click"], ["href", "https://www.gov.uk", "title", "Go to the GOV.UK homepage", "id", "logo", 1, "content", 2, "margin-left", "0px"], ["src", "/img/gov.uk_logotype_crown_invert_trans.png?0.23.0", "width", "36", "height", "32", "alt", ""], [1, "global-header"], [1, "title"], ["id", "proposition-menu"], [1, "title-solicitor"], ["id", "proposition-name"]], template: function HeaderBarComponent_Template(rf, ctx) { if (rf & 1) {
202
+ HeaderBarComponent.ɵcmp = i0.ɵɵdefineComponent({ type: HeaderBarComponent, selectors: [["cut-header-bar"]], inputs: { title: "title", isSolicitor: "isSolicitor", username: "username" }, outputs: { signOutRequest: "signOutRequest" }, ngContentSelectors: _c1$r, decls: 15, vars: 8, consts: [["role", "banner", "id", "global-header", 1, "with-proposition"], [1, "header-wrapper"], [1, "header-global"], [4, "ngIf"], ["class", "global-header", 4, "ngIf"], [1, "header-proposition"], [1, "content"], ["href", "#proposition-links", 1, "js-header-toggle", "menu"], ["id", "proposition-menu", 4, "ngIf"], [1, "proposition-right"], ["id", "user-name"], ["id", "sign-out", "href", "javascript:void(0)", 3, "click"], ["href", "https://www.gov.uk", "title", "Go to the GOV.UK homepage", "id", "logo", 1, "content", 2, "margin-left", "0px"], ["src", "/img/gov.uk_logotype_crown_invert_trans.png?0.23.0", "width", "36", "height", "32", "alt", ""], [1, "global-header"], [1, "title"], ["id", "proposition-menu"], [1, "title-solicitor"], ["id", "proposition-name"]], template: function HeaderBarComponent_Template(rf, ctx) { if (rf & 1) {
203
203
  i0.ɵɵprojectionDef(_c0$Z);
204
204
  i0.ɵɵelementStart(0, "header", 0);
205
205
  i0.ɵɵelementStart(1, "div", 1);
@@ -258,11 +258,11 @@ HeaderBarComponent.ɵcmp = i0.ɵɵdefineComponent({ type: HeaderBarComponent, se
258
258
  }] }); })();
259
259
 
260
260
  const _c0$Y = [[["", "leftNavLinks", ""]], [["", "rightNavLinks", ""]]];
261
- const _c1$p = ["[leftNavLinks]", "[rightNavLinks]"];
261
+ const _c1$q = ["[leftNavLinks]", "[rightNavLinks]"];
262
262
  class NavigationComponent {
263
263
  }
264
264
  NavigationComponent.ɵfac = function NavigationComponent_Factory(t) { return new (t || NavigationComponent)(); };
265
- NavigationComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NavigationComponent, selectors: [["cut-nav-bar"]], inputs: { isSolicitor: "isSolicitor" }, ngContentSelectors: _c1$p, decls: 4, vars: 2, consts: [[1, "cut-nav-bar"]], template: function NavigationComponent_Template(rf, ctx) { if (rf & 1) {
265
+ NavigationComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NavigationComponent, selectors: [["cut-nav-bar"]], inputs: { isSolicitor: "isSolicitor" }, ngContentSelectors: _c1$q, decls: 4, vars: 2, consts: [[1, "cut-nav-bar"]], template: function NavigationComponent_Template(rf, ctx) { if (rf & 1) {
266
266
  i0.ɵɵprojectionDef(_c0$Y);
267
267
  i0.ɵɵelementStart(0, "div");
268
268
  i0.ɵɵelementStart(1, "nav", 0);
@@ -381,11 +381,11 @@ HeadersModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[CommonModule, RouterMod
381
381
  }], null, null); })();
382
382
 
383
383
  const _c0$X = [[["", "topBody", ""]], [["", "leftBody", ""]], [["", "rightBody", ""]]];
384
- const _c1$o = ["[topBody]", "[leftBody]", "[rightBody]"];
384
+ const _c1$p = ["[topBody]", "[leftBody]", "[rightBody]"];
385
385
  class BodyComponent {
386
386
  }
387
387
  BodyComponent.ɵfac = function BodyComponent_Factory(t) { return new (t || BodyComponent)(); };
388
- BodyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BodyComponent, selectors: [["cut-body"]], ngContentSelectors: _c1$o, decls: 4, vars: 0, consts: [[1, "global-display"]], template: function BodyComponent_Template(rf, ctx) { if (rf & 1) {
388
+ BodyComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BodyComponent, selectors: [["cut-body"]], ngContentSelectors: _c1$p, decls: 4, vars: 0, consts: [[1, "global-display"]], template: function BodyComponent_Template(rf, ctx) { if (rf & 1) {
389
389
  i0.ɵɵprojectionDef(_c0$X);
390
390
  i0.ɵɵelementStart(0, "div", 0);
391
391
  i0.ɵɵprojection(1);
@@ -1012,11 +1012,11 @@ NotificationBannerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NotificationB
1012
1012
  }] }); })();
1013
1013
 
1014
1014
  const _c0$U = function (a0) { return { "js-hidden": a0 }; };
1015
- const _c1$n = ["*"];
1015
+ const _c1$o = ["*"];
1016
1016
  class TabComponent {
1017
1017
  }
1018
1018
  TabComponent.ɵfac = function TabComponent_Factory(t) { return new (t || TabComponent)(); };
1019
- TabComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TabComponent, selectors: [["cut-tab"]], inputs: { id: "id", title: "title", selected: "selected" }, ngContentSelectors: _c1$n, decls: 2, vars: 5, consts: [["role", "tabpanel", 1, "tabs-panel", 3, "id", "ngClass"]], template: function TabComponent_Template(rf, ctx) { if (rf & 1) {
1019
+ TabComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TabComponent, selectors: [["cut-tab"]], inputs: { id: "id", title: "title", selected: "selected" }, ngContentSelectors: _c1$o, decls: 2, vars: 5, consts: [["role", "tabpanel", 1, "tabs-panel", 3, "id", "ngClass"]], template: function TabComponent_Template(rf, ctx) { if (rf & 1) {
1020
1020
  i0.ɵɵprojectionDef();
1021
1021
  i0.ɵɵelementStart(0, "div", 0);
1022
1022
  i0.ɵɵprojection(1);
@@ -1043,7 +1043,7 @@ TabComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TabComponent, selectors: [["
1043
1043
  }] }); })();
1044
1044
 
1045
1045
  const _c0$T = ["tab"];
1046
- const _c1$m = function () { return ["."]; };
1046
+ const _c1$n = function () { return ["."]; };
1047
1047
  const _c2$3 = function (a0) { return { "tabs-toggle-selected": a0 }; };
1048
1048
  function TabsComponent_li_2_Template(rf, ctx) { if (rf & 1) {
1049
1049
  const _r4 = i0.ɵɵgetCurrentView();
@@ -1056,7 +1056,7 @@ function TabsComponent_li_2_Template(rf, ctx) { if (rf & 1) {
1056
1056
  } if (rf & 2) {
1057
1057
  const panel_r1 = ctx.$implicit;
1058
1058
  i0.ɵɵadvance(1);
1059
- i0.ɵɵproperty("routerLink", i0.ɵɵpureFunction0(6, _c1$m))("fragment", panel_r1.id)("ngClass", i0.ɵɵpureFunction1(7, _c2$3, panel_r1.selected));
1059
+ i0.ɵɵproperty("routerLink", i0.ɵɵpureFunction0(6, _c1$n))("fragment", panel_r1.id)("ngClass", i0.ɵɵpureFunction1(7, _c2$3, panel_r1.selected));
1060
1060
  i0.ɵɵattribute("aria-controls", panel_r1.id)("aria-selected", panel_r1.selected);
1061
1061
  i0.ɵɵadvance(2);
1062
1062
  i0.ɵɵtextInterpolate(panel_r1.title);
@@ -3314,7 +3314,7 @@ class FieldsUtils {
3314
3314
  if (!caseField) {
3315
3315
  return false;
3316
3316
  }
3317
- return caseField.field_type.collection_field_type.id === 'CaseLink';
3317
+ return caseField.field_type.collection_field_type.id === 'CaseLink' && caseField.id === 'caseLinks';
3318
3318
  }
3319
3319
  static cloneObject(obj) {
3320
3320
  return Object.assign({}, obj);
@@ -4216,18 +4216,18 @@ class AbstractFormFieldComponent {
4216
4216
  return control;
4217
4217
  }
4218
4218
  addControlToFormGroup(control, parent, replace) {
4219
- if (replace) {
4220
- if (this.caseField.field_type && this.caseField.field_type.collection_field_type
4221
- && this.caseField.field_type.collection_field_type.id === 'CaseLink'
4222
- && this.caseField.field_type.type === 'Complex' && /^-?\d+$/.test(this.caseField.id)) {
4223
- parent.setControl('CaseReference', control['controls']['CaseReference']);
4224
- }
4225
- else {
4226
- parent.setControl(this.caseField.id, control);
4227
- }
4219
+ if (!replace) {
4220
+ parent.addControl(this.caseField.id, control);
4221
+ return control;
4222
+ }
4223
+ if (this.caseField.field_type && this.caseField.field_type.id === 'CaseLink'
4224
+ && this.caseField.field_type.type === 'Complex'
4225
+ && this.caseField.field_type.complex_fields.some(cf => cf.id === 'CaseReference')
4226
+ && this.caseField.id !== 'caseLinks') {
4227
+ parent.setControl('CaseReference', control['controls']['CaseReference']);
4228
4228
  }
4229
4229
  else {
4230
- parent.addControl(this.caseField.id, control);
4230
+ parent.setControl(this.caseField.id, control);
4231
4231
  }
4232
4232
  return control;
4233
4233
  }
@@ -10284,7 +10284,7 @@ function WriteAddressFieldComponent_div_1_div_4_span_4_Template(rf, ctx) { if (r
10284
10284
  i0.ɵɵtext(1, "Enter the Postcode");
10285
10285
  i0.ɵɵelementEnd();
10286
10286
  } }
10287
- const _c1$l = function (a0) { return { "form-group-error": a0 }; };
10287
+ const _c1$m = function (a0) { return { "form-group-error": a0 }; };
10288
10288
  const _c2$2 = function (a0) { return { "govuk-input--error": a0 }; };
10289
10289
  function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) { if (rf & 1) {
10290
10290
  const _r7 = i0.ɵɵgetCurrentView();
@@ -10303,7 +10303,7 @@ function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) { if (rf & 1)
10303
10303
  i0.ɵɵelementEnd();
10304
10304
  } if (rf & 2) {
10305
10305
  const ctx_r2 = i0.ɵɵnextContext(2);
10306
- i0.ɵɵproperty("id", ctx_r2.createElementId("postcodeLookup"))("ngClass", i0.ɵɵpureFunction1(7, _c1$l, ctx_r2.missingPostcode));
10306
+ i0.ɵɵproperty("id", ctx_r2.createElementId("postcodeLookup"))("ngClass", i0.ɵɵpureFunction1(7, _c1$m, ctx_r2.missingPostcode));
10307
10307
  i0.ɵɵadvance(1);
10308
10308
  i0.ɵɵproperty("for", ctx_r2.createElementId("postcodeInput"));
10309
10309
  i0.ɵɵadvance(3);
@@ -11460,7 +11460,8 @@ class ReadCaseLinkFieldComponent extends AbstractFieldReadComponent {
11460
11460
  hasCaseLinkCollection() {
11461
11461
  return (this.caseField.field_type &&
11462
11462
  this.caseField.field_type.type === 'Collection' &&
11463
- this.caseField.field_type.collection_field_type.id === 'CaseLink');
11463
+ this.caseField.field_type.collection_field_type.id === 'CaseLink' &&
11464
+ this.caseField.id === 'caseLinks');
11464
11465
  }
11465
11466
  }
11466
11467
  ReadCaseLinkFieldComponent.ɵfac = function ReadCaseLinkFieldComponent_Factory(t) { return ɵReadCaseLinkFieldComponent_BaseFactory(t || ReadCaseLinkFieldComponent); };
@@ -11483,7 +11484,7 @@ const ɵReadCaseLinkFieldComponent_BaseFactory = /*@__PURE__*/ i0.ɵɵgetInherit
11483
11484
 
11484
11485
  const _c0$P = ["writeComplexFieldComponent"];
11485
11486
  function WriteCaseLinkFieldComponent_div_1_span_2_Template(rf, ctx) { if (rf & 1) {
11486
- i0.ɵɵelementStart(0, "span", 6);
11487
+ i0.ɵɵelementStart(0, "span", 8);
11487
11488
  i0.ɵɵtext(1);
11488
11489
  i0.ɵɵpipe(2, "ccdFieldLabel");
11489
11490
  i0.ɵɵelementEnd();
@@ -11493,7 +11494,7 @@ function WriteCaseLinkFieldComponent_div_1_span_2_Template(rf, ctx) { if (rf & 1
11493
11494
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r2.caseField));
11494
11495
  } }
11495
11496
  function WriteCaseLinkFieldComponent_div_1_span_3_Template(rf, ctx) { if (rf & 1) {
11496
- i0.ɵɵelementStart(0, "span", 7);
11497
+ i0.ɵɵelementStart(0, "span", 9);
11497
11498
  i0.ɵɵtext(1);
11498
11499
  i0.ɵɵelementEnd();
11499
11500
  } if (rf & 2) {
@@ -11501,30 +11502,45 @@ function WriteCaseLinkFieldComponent_div_1_span_3_Template(rf, ctx) { if (rf & 1
11501
11502
  i0.ɵɵadvance(1);
11502
11503
  i0.ɵɵtextInterpolate(ctx_r3.caseField.hint_text);
11503
11504
  } }
11505
+ function WriteCaseLinkFieldComponent_div_1_span_4_Template(rf, ctx) { if (rf & 1) {
11506
+ i0.ɵɵelementStart(0, "span", 10);
11507
+ i0.ɵɵtext(1);
11508
+ i0.ɵɵpipe(2, "ccdFirstError");
11509
+ i0.ɵɵelementEnd();
11510
+ } if (rf & 2) {
11511
+ const ctx_r4 = i0.ɵɵnextContext(2);
11512
+ i0.ɵɵadvance(1);
11513
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(2, 1, ctx_r4.caseReferenceControl.errors, ctx_r4.caseField.label));
11514
+ } }
11515
+ const _c1$l = function (a0) { return { "form-group-error": a0 }; };
11504
11516
  function WriteCaseLinkFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
11505
- i0.ɵɵelementStart(0, "div", 1);
11506
- i0.ɵɵelementStart(1, "label", 2);
11507
- i0.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_1_span_2_Template, 3, 3, "span", 3);
11517
+ i0.ɵɵelementStart(0, "div", 2);
11518
+ i0.ɵɵelementStart(1, "label", 3);
11519
+ i0.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_1_span_2_Template, 3, 3, "span", 4);
11508
11520
  i0.ɵɵelementEnd();
11509
- i0.ɵɵtemplate(3, WriteCaseLinkFieldComponent_div_1_span_3_Template, 2, 1, "span", 4);
11510
- i0.ɵɵelement(4, "input", 5);
11521
+ i0.ɵɵtemplate(3, WriteCaseLinkFieldComponent_div_1_span_3_Template, 2, 1, "span", 5);
11522
+ i0.ɵɵtemplate(4, WriteCaseLinkFieldComponent_div_1_span_4_Template, 3, 4, "span", 6);
11523
+ i0.ɵɵelement(5, "input", 7);
11511
11524
  i0.ɵɵelementEnd();
11512
11525
  } if (rf & 2) {
11513
11526
  const ctx_r0 = i0.ɵɵnextContext();
11527
+ i0.ɵɵproperty("formGroup", ctx_r0.caseLinkGroup)("ngClass", i0.ɵɵpureFunction1(8, _c1$l, !ctx_r0.caseReferenceControl.valid && (ctx_r0.caseReferenceControl.dirty || ctx_r0.caseReferenceControl.touched)));
11514
11528
  i0.ɵɵadvance(1);
11515
- i0.ɵɵproperty("for", ctx_r0.id());
11529
+ i0.ɵɵproperty("for", ctx_r0.caseReferenceControl);
11516
11530
  i0.ɵɵadvance(1);
11517
11531
  i0.ɵɵproperty("ngIf", ctx_r0.caseField.label);
11518
11532
  i0.ɵɵadvance(1);
11519
11533
  i0.ɵɵproperty("ngIf", ctx_r0.caseField.hint_text);
11520
11534
  i0.ɵɵadvance(1);
11521
- i0.ɵɵproperty("id", ctx_r0.id())("formControl", ctx_r0.caseReferenceControl);
11535
+ i0.ɵɵproperty("ngIf", ctx_r0.caseReferenceControl.errors && (ctx_r0.caseReferenceControl.dirty || ctx_r0.caseReferenceControl.touched));
11536
+ i0.ɵɵadvance(1);
11537
+ i0.ɵɵproperty("id", ctx_r0.caseReferenceControl)("formControl", ctx_r0.caseReferenceControl);
11522
11538
  } }
11523
11539
  function WriteCaseLinkFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11524
- const _r5 = i0.ɵɵgetCurrentView();
11525
- i0.ɵɵelementStart(0, "div", 1);
11526
- i0.ɵɵelementStart(1, "ccd-write-linked-cases", 8);
11527
- i0.ɵɵlistener("onLinkedCasesSelected", function WriteCaseLinkFieldComponent_div_2_Template_ccd_write_linked_cases_onLinkedCasesSelected_1_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.submitLinkedCases(); });
11540
+ const _r6 = i0.ɵɵgetCurrentView();
11541
+ i0.ɵɵelementStart(0, "div", 11);
11542
+ i0.ɵɵelementStart(1, "ccd-write-linked-cases", 12);
11543
+ i0.ɵɵlistener("onLinkedCasesSelected", function WriteCaseLinkFieldComponent_div_2_Template_ccd_write_linked_cases_onLinkedCasesSelected_1_listener() { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(); return ctx_r5.submitLinkedCases(); });
11528
11544
  i0.ɵɵelementEnd();
11529
11545
  i0.ɵɵelementEnd();
11530
11546
  } if (rf & 2) {
@@ -11539,22 +11555,61 @@ class WriteCaseLinkFieldComponent extends AbstractFieldWriteComponent {
11539
11555
  this.caseFields = [];
11540
11556
  }
11541
11557
  ngOnInit() {
11542
- this.formArray = this.registerControl(new FormArray([]), true);
11543
- this.formArray['caseField'] = this.caseField;
11544
- if (!this.hasCaseLinkCollection()) {
11545
- this.caseLinkGroup = this.registerControl(new FormGroup({
11546
- CaseReference: new FormControl(this.caseField.value.CaseReference, Validators.required),
11547
- }), true);
11558
+ // Will be TRUE for new Case link/unlink journey
11559
+ this.containsCaseLinkCollection = this.hasCaseLinkCollection();
11560
+ if (!this.containsCaseLinkCollection) {
11561
+ if (this.caseField.value) {
11562
+ this.caseLinkGroup = this.registerControl(new FormGroup({
11563
+ CaseReference: new FormControl(this.caseField.value.CaseReference, Validators.required),
11564
+ }), true);
11565
+ }
11566
+ else {
11567
+ this.caseLinkGroup = this.registerControl(new FormGroup({
11568
+ CaseReference: new FormControl(null, Validators.required),
11569
+ }), true);
11570
+ }
11571
+ this.caseReferenceControl = this.caseLinkGroup.controls['CaseReference'];
11572
+ this.caseReferenceControl.setValidators(this.caseReferenceValidator());
11573
+ // Ensure that all sub-fields inherit the same value for retain_hidden_value as this parent; although a CaseLink
11574
+ // field uses the Complex type, it is meant to be treated as one field
11575
+ if (this.caseField && this.caseField.field_type.type === 'Complex') {
11576
+ for (const caseLinkSubField of this.caseField.field_type.complex_fields) {
11577
+ caseLinkSubField.retain_hidden_value = this.caseField.retain_hidden_value;
11578
+ }
11579
+ }
11548
11580
  }
11549
- // Ensure that all sub-fields inherit the same value for retain_hidden_value as this parent; although a CaseLink
11550
- // field uses the Complex type, it is meant to be treated as one field
11551
- if (this.caseField && this.caseField.field_type.type === 'Complex') {
11552
- for (const caseLinkSubField of this.caseField.field_type.complex_fields) {
11553
- caseLinkSubField.retain_hidden_value = this.caseField.retain_hidden_value;
11581
+ }
11582
+ caseReferenceValidator() {
11583
+ return (control) => {
11584
+ if (control.value) {
11585
+ if (this.validCaseReference(control.value)) {
11586
+ return null;
11587
+ }
11588
+ return { error: 'Please use a valid 16 Digit Case Reference' };
11554
11589
  }
11590
+ else {
11591
+ if (control.touched) {
11592
+ return { error: 'Please use a valid 16 Digit Case Reference' };
11593
+ }
11594
+ }
11595
+ return null;
11596
+ };
11597
+ }
11598
+ validCaseReference(valueString) {
11599
+ if (!valueString) {
11600
+ return false;
11555
11601
  }
11556
- this.containsCaseLinkCollection = this.hasCaseLinkCollection();
11602
+ return new RegExp('^\\b\\d{4}[ -]?\\d{4}[ -]?\\d{4}[ -]?\\d{4}\\b$').test(valueString.trim());
11603
+ }
11604
+ hasCaseLinkCollection() {
11605
+ return (this.caseField.field_type &&
11606
+ this.caseField.field_type.type === 'Collection' &&
11607
+ this.caseField.field_type.collection_field_type.id === 'CaseLink' &&
11608
+ this.caseField.id === 'caseLinks');
11557
11609
  }
11610
+ /**
11611
+ * This method is applicable only for new Case link/unlink journey
11612
+ */
11558
11613
  submitLinkedCases() {
11559
11614
  const formGroup = this.formGroup;
11560
11615
  if (!this.linkedCasesService.isLinkedCasesEventTrigger) {
@@ -11566,17 +11621,6 @@ class WriteCaseLinkFieldComponent extends AbstractFieldWriteComponent {
11566
11621
  this.formGroup.value.caseLinks = this.linkedCasesService.caseFieldValue;
11567
11622
  }
11568
11623
  }
11569
- validCaseReference(valueString) {
11570
- if (!valueString) {
11571
- return false;
11572
- }
11573
- return new RegExp('^\\b\\d{4}[ -]?\\d{4}[ -]?\\d{4}[ -]?\\d{4}\\b$').test(valueString.trim());
11574
- }
11575
- hasCaseLinkCollection() {
11576
- return (this.caseField.field_type &&
11577
- this.caseField.field_type.type === 'Collection' &&
11578
- this.caseField.field_type.collection_field_type.id === 'CaseLink');
11579
- }
11580
11624
  }
11581
11625
  WriteCaseLinkFieldComponent.ɵfac = function WriteCaseLinkFieldComponent_Factory(t) { return new (t || WriteCaseLinkFieldComponent)(i0.ɵɵdirectiveInject(LinkedCasesService)); };
11582
11626
  WriteCaseLinkFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseLinkFieldComponent, selectors: [["ccd-write-case-link-field"]], viewQuery: function WriteCaseLinkFieldComponent_Query(rf, ctx) { if (rf & 1) {
@@ -11584,10 +11628,10 @@ WriteCaseLinkFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseLink
11584
11628
  } if (rf & 2) {
11585
11629
  let _t;
11586
11630
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
11587
- } }, inputs: { caseFields: "caseFields", formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["class", "form-group", 4, "ngIf"], [1, "form-group"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["type", "text", 1, "form-control", "bottom-30", 3, "id", "formControl"], [1, "form-label"], [1, "form-hint"], [3, "caseFields", "caseField", "formGroup", "isLinkedCasesJourney", "onLinkedCasesSelected"]], template: function WriteCaseLinkFieldComponent_Template(rf, ctx) { if (rf & 1) {
11631
+ } }, inputs: { caseFields: "caseFields", formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["class", "form-group", 3, "formGroup", "ngClass", 4, "ngIf"], ["class", "form-group", 4, "ngIf"], [1, "form-group", 3, "formGroup", "ngClass"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], ["type", "text", 1, "form-control", "bottom-30", 3, "id", "formControl"], [1, "form-label"], [1, "form-hint"], [1, "error-message"], [1, "form-group"], [3, "caseFields", "caseField", "formGroup", "isLinkedCasesJourney", "onLinkedCasesSelected"]], template: function WriteCaseLinkFieldComponent_Template(rf, ctx) { if (rf & 1) {
11588
11632
  i0.ɵɵelementContainerStart(0);
11589
- i0.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 5, 5, "div", 0);
11590
- i0.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 0);
11633
+ i0.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 6, 10, "div", 0);
11634
+ i0.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 1);
11591
11635
  i0.ɵɵelementContainerEnd();
11592
11636
  } if (rf & 2) {
11593
11637
  i0.ɵɵadvance(1);
@@ -15341,6 +15385,8 @@ class PaletteService {
15341
15385
  default:
15342
15386
  return write ? WriteComplexFieldComponent : ReadComplexFieldComponent;
15343
15387
  }
15388
+ case 'CaseLink':
15389
+ return write ? WriteCaseLinkFieldComponent : ReadCaseLinkFieldComponent;
15344
15390
  case 'Collection':
15345
15391
  switch (caseField.field_type.collection_field_type.id) {
15346
15392
  case 'CaseLink':
@@ -22133,7 +22179,7 @@ i0.ɵɵsetComponentScope(WriteOrganisationFieldComponent, [i2.NgControlStatusGro
22133
22179
  WriteOrganisationComplexFieldComponent], [i1.AsyncPipe]);
22134
22180
  i0.ɵɵsetComponentScope(WriteOrderSummaryFieldComponent, [ReadOrderSummaryFieldComponent], []);
22135
22181
  i0.ɵɵsetComponentScope(WriteDateContainerFieldComponent, [i1.NgIf, DatetimePickerComponent, i2.NgControlStatusGroup, i2.FormGroupDirective, WriteDateFieldComponent], []);
22136
- i0.ɵɵsetComponentScope(WriteCaseLinkFieldComponent, [i1.NgIf, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlDirective, WriteLinkedCasesComponent, i2.NgControlStatusGroup, i2.FormGroupDirective], [FieldLabelPipe]);
22182
+ i0.ɵɵsetComponentScope(WriteCaseLinkFieldComponent, [i1.NgIf, i2.NgControlStatusGroup, i2.FormGroupDirective, i1.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlDirective, WriteLinkedCasesComponent], [FieldLabelPipe, FirstErrorPipe]);
22137
22183
  i0.ɵɵsetComponentScope(WriteCollectionFieldComponent, [i1.NgIf, i1.NgForOf, FieldWriteComponent, i2.NgControlStatusGroup, i2.FormGroupDirective], [FieldLabelPipe, FirstErrorPipe]);
22138
22184
  i0.ɵɵsetComponentScope(
22139
22185
  // ComponentLauncher web components