@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.
@@ -119,14 +119,14 @@
119
119
  }
120
120
  }
121
121
  var _c0$_ = [[["", "footerSolsNavLinks", ""]], [["", "footerCaseWorkerNavLinks", ""]]];
122
- var _c1$r = ["[footerSolsNavLinks]", "[footerCaseWorkerNavLinks]"];
122
+ var _c1$s = ["[footerSolsNavLinks]", "[footerCaseWorkerNavLinks]"];
123
123
  var FooterComponent = /** @class */ (function () {
124
124
  function FooterComponent() {
125
125
  }
126
126
  return FooterComponent;
127
127
  }());
128
128
  FooterComponent.ɵfac = function FooterComponent_Factory(t) { return new (t || FooterComponent)(); };
129
- FooterComponent.ɵcmp = i0__namespace.ɵɵ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) {
129
+ FooterComponent.ɵcmp = i0__namespace.ɵɵ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) {
130
130
  if (rf & 1) {
131
131
  i0__namespace.ɵɵprojectionDef(_c0$_);
132
132
  i0__namespace.ɵɵelementStart(0, "footer", 0);
@@ -208,7 +208,7 @@
208
208
  }
209
209
  }
210
210
  var _c0$Z = [[["", "headerNavigation", ""]]];
211
- var _c1$q = ["[headerNavigation]"];
211
+ var _c1$r = ["[headerNavigation]"];
212
212
  var HeaderBarComponent = /** @class */ (function () {
213
213
  function HeaderBarComponent() {
214
214
  this.signOutRequest = new i0.EventEmitter();
@@ -219,7 +219,7 @@
219
219
  return HeaderBarComponent;
220
220
  }());
221
221
  HeaderBarComponent.ɵfac = function HeaderBarComponent_Factory(t) { return new (t || HeaderBarComponent)(); };
222
- HeaderBarComponent.ɵcmp = i0__namespace.ɵɵ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) {
222
+ HeaderBarComponent.ɵcmp = i0__namespace.ɵɵ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) {
223
223
  if (rf & 1) {
224
224
  i0__namespace.ɵɵprojectionDef(_c0$Z);
225
225
  i0__namespace.ɵɵelementStart(0, "header", 0);
@@ -283,14 +283,14 @@
283
283
  })();
284
284
 
285
285
  var _c0$Y = [[["", "leftNavLinks", ""]], [["", "rightNavLinks", ""]]];
286
- var _c1$p = ["[leftNavLinks]", "[rightNavLinks]"];
286
+ var _c1$q = ["[leftNavLinks]", "[rightNavLinks]"];
287
287
  var NavigationComponent = /** @class */ (function () {
288
288
  function NavigationComponent() {
289
289
  }
290
290
  return NavigationComponent;
291
291
  }());
292
292
  NavigationComponent.ɵfac = function NavigationComponent_Factory(t) { return new (t || NavigationComponent)(); };
293
- NavigationComponent.ɵcmp = i0__namespace.ɵɵ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) {
293
+ NavigationComponent.ɵcmp = i0__namespace.ɵɵ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) {
294
294
  if (rf & 1) {
295
295
  i0__namespace.ɵɵprojectionDef(_c0$Y);
296
296
  i0__namespace.ɵɵelementStart(0, "div");
@@ -438,14 +438,14 @@
438
438
  })();
439
439
 
440
440
  var _c0$X = [[["", "topBody", ""]], [["", "leftBody", ""]], [["", "rightBody", ""]]];
441
- var _c1$o = ["[topBody]", "[leftBody]", "[rightBody]"];
441
+ var _c1$p = ["[topBody]", "[leftBody]", "[rightBody]"];
442
442
  var BodyComponent = /** @class */ (function () {
443
443
  function BodyComponent() {
444
444
  }
445
445
  return BodyComponent;
446
446
  }());
447
447
  BodyComponent.ɵfac = function BodyComponent_Factory(t) { return new (t || BodyComponent)(); };
448
- BodyComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: BodyComponent, selectors: [["cut-body"]], ngContentSelectors: _c1$o, decls: 4, vars: 0, consts: [[1, "global-display"]], template: function BodyComponent_Template(rf, ctx) {
448
+ BodyComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: BodyComponent, selectors: [["cut-body"]], ngContentSelectors: _c1$p, decls: 4, vars: 0, consts: [[1, "global-display"]], template: function BodyComponent_Template(rf, ctx) {
449
449
  if (rf & 1) {
450
450
  i0__namespace.ɵɵprojectionDef(_c0$X);
451
451
  i0__namespace.ɵɵelementStart(0, "div", 0);
@@ -1472,14 +1472,14 @@
1472
1472
  })();
1473
1473
 
1474
1474
  var _c0$U = function (a0) { return { "js-hidden": a0 }; };
1475
- var _c1$n = ["*"];
1475
+ var _c1$o = ["*"];
1476
1476
  var TabComponent = /** @class */ (function () {
1477
1477
  function TabComponent() {
1478
1478
  }
1479
1479
  return TabComponent;
1480
1480
  }());
1481
1481
  TabComponent.ɵfac = function TabComponent_Factory(t) { return new (t || TabComponent)(); };
1482
- TabComponent.ɵcmp = i0__namespace.ɵɵ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) {
1482
+ TabComponent.ɵcmp = i0__namespace.ɵɵ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) {
1483
1483
  if (rf & 1) {
1484
1484
  i0__namespace.ɵɵprojectionDef();
1485
1485
  i0__namespace.ɵɵelementStart(0, "div", 0);
@@ -1511,7 +1511,7 @@
1511
1511
  })();
1512
1512
 
1513
1513
  var _c0$T = ["tab"];
1514
- var _c1$m = function () { return ["."]; };
1514
+ var _c1$n = function () { return ["."]; };
1515
1515
  var _c2$3 = function (a0) { return { "tabs-toggle-selected": a0 }; };
1516
1516
  function TabsComponent_li_2_Template(rf, ctx) {
1517
1517
  if (rf & 1) {
@@ -1526,7 +1526,7 @@
1526
1526
  if (rf & 2) {
1527
1527
  var panel_r1 = ctx.$implicit;
1528
1528
  i0__namespace.ɵɵadvance(1);
1529
- i0__namespace.ɵɵproperty("routerLink", i0__namespace.ɵɵpureFunction0(6, _c1$m))("fragment", panel_r1.id)("ngClass", i0__namespace.ɵɵpureFunction1(7, _c2$3, panel_r1.selected));
1529
+ i0__namespace.ɵɵproperty("routerLink", i0__namespace.ɵɵpureFunction0(6, _c1$n))("fragment", panel_r1.id)("ngClass", i0__namespace.ɵɵpureFunction1(7, _c2$3, panel_r1.selected));
1530
1530
  i0__namespace.ɵɵattribute("aria-controls", panel_r1.id)("aria-selected", panel_r1.selected);
1531
1531
  i0__namespace.ɵɵadvance(2);
1532
1532
  i0__namespace.ɵɵtextInterpolate(panel_r1.title);
@@ -3923,7 +3923,7 @@
3923
3923
  if (!caseField) {
3924
3924
  return false;
3925
3925
  }
3926
- return caseField.field_type.collection_field_type.id === 'CaseLink';
3926
+ return caseField.field_type.collection_field_type.id === 'CaseLink' && caseField.id === 'caseLinks';
3927
3927
  };
3928
3928
  FieldsUtils.cloneObject = function (obj) {
3929
3929
  return Object.assign({}, obj);
@@ -4863,18 +4863,18 @@
4863
4863
  return control;
4864
4864
  };
4865
4865
  AbstractFormFieldComponent.prototype.addControlToFormGroup = function (control, parent, replace) {
4866
- if (replace) {
4867
- if (this.caseField.field_type && this.caseField.field_type.collection_field_type
4868
- && this.caseField.field_type.collection_field_type.id === 'CaseLink'
4869
- && this.caseField.field_type.type === 'Complex' && /^-?\d+$/.test(this.caseField.id)) {
4870
- parent.setControl('CaseReference', control['controls']['CaseReference']);
4871
- }
4872
- else {
4873
- parent.setControl(this.caseField.id, control);
4874
- }
4866
+ if (!replace) {
4867
+ parent.addControl(this.caseField.id, control);
4868
+ return control;
4869
+ }
4870
+ if (this.caseField.field_type && this.caseField.field_type.id === 'CaseLink'
4871
+ && this.caseField.field_type.type === 'Complex'
4872
+ && this.caseField.field_type.complex_fields.some(function (cf) { return cf.id === 'CaseReference'; })
4873
+ && this.caseField.id !== 'caseLinks') {
4874
+ parent.setControl('CaseReference', control['controls']['CaseReference']);
4875
4875
  }
4876
4876
  else {
4877
- parent.addControl(this.caseField.id, control);
4877
+ parent.setControl(this.caseField.id, control);
4878
4878
  }
4879
4879
  return control;
4880
4880
  };
@@ -11695,7 +11695,7 @@
11695
11695
  i0__namespace.ɵɵelementEnd();
11696
11696
  }
11697
11697
  }
11698
- var _c1$l = function (a0) { return { "form-group-error": a0 }; };
11698
+ var _c1$m = function (a0) { return { "form-group-error": a0 }; };
11699
11699
  var _c2$2 = function (a0) { return { "govuk-input--error": a0 }; };
11700
11700
  function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) {
11701
11701
  if (rf & 1) {
@@ -11716,7 +11716,7 @@
11716
11716
  }
11717
11717
  if (rf & 2) {
11718
11718
  var ctx_r2 = i0__namespace.ɵɵnextContext(2);
11719
- i0__namespace.ɵɵproperty("id", ctx_r2.createElementId("postcodeLookup"))("ngClass", i0__namespace.ɵɵpureFunction1(7, _c1$l, ctx_r2.missingPostcode));
11719
+ i0__namespace.ɵɵproperty("id", ctx_r2.createElementId("postcodeLookup"))("ngClass", i0__namespace.ɵɵpureFunction1(7, _c1$m, ctx_r2.missingPostcode));
11720
11720
  i0__namespace.ɵɵadvance(1);
11721
11721
  i0__namespace.ɵɵproperty("for", ctx_r2.createElementId("postcodeInput"));
11722
11722
  i0__namespace.ɵɵadvance(3);
@@ -13007,7 +13007,8 @@
13007
13007
  ReadCaseLinkFieldComponent.prototype.hasCaseLinkCollection = function () {
13008
13008
  return (this.caseField.field_type &&
13009
13009
  this.caseField.field_type.type === 'Collection' &&
13010
- this.caseField.field_type.collection_field_type.id === 'CaseLink');
13010
+ this.caseField.field_type.collection_field_type.id === 'CaseLink' &&
13011
+ this.caseField.id === 'caseLinks');
13011
13012
  };
13012
13013
  return ReadCaseLinkFieldComponent;
13013
13014
  }(AbstractFieldReadComponent));
@@ -13037,7 +13038,7 @@
13037
13038
  var _c0$P = ["writeComplexFieldComponent"];
13038
13039
  function WriteCaseLinkFieldComponent_div_1_span_2_Template(rf, ctx) {
13039
13040
  if (rf & 1) {
13040
- i0__namespace.ɵɵelementStart(0, "span", 6);
13041
+ i0__namespace.ɵɵelementStart(0, "span", 8);
13041
13042
  i0__namespace.ɵɵtext(1);
13042
13043
  i0__namespace.ɵɵpipe(2, "ccdFieldLabel");
13043
13044
  i0__namespace.ɵɵelementEnd();
@@ -13050,7 +13051,7 @@
13050
13051
  }
13051
13052
  function WriteCaseLinkFieldComponent_div_1_span_3_Template(rf, ctx) {
13052
13053
  if (rf & 1) {
13053
- i0__namespace.ɵɵelementStart(0, "span", 7);
13054
+ i0__namespace.ɵɵelementStart(0, "span", 9);
13054
13055
  i0__namespace.ɵɵtext(1);
13055
13056
  i0__namespace.ɵɵelementEnd();
13056
13057
  }
@@ -13060,34 +13061,52 @@
13060
13061
  i0__namespace.ɵɵtextInterpolate(ctx_r3.caseField.hint_text);
13061
13062
  }
13062
13063
  }
13064
+ function WriteCaseLinkFieldComponent_div_1_span_4_Template(rf, ctx) {
13065
+ if (rf & 1) {
13066
+ i0__namespace.ɵɵelementStart(0, "span", 10);
13067
+ i0__namespace.ɵɵtext(1);
13068
+ i0__namespace.ɵɵpipe(2, "ccdFirstError");
13069
+ i0__namespace.ɵɵelementEnd();
13070
+ }
13071
+ if (rf & 2) {
13072
+ var ctx_r4 = i0__namespace.ɵɵnextContext(2);
13073
+ i0__namespace.ɵɵadvance(1);
13074
+ i0__namespace.ɵɵtextInterpolate(i0__namespace.ɵɵpipeBind2(2, 1, ctx_r4.caseReferenceControl.errors, ctx_r4.caseField.label));
13075
+ }
13076
+ }
13077
+ var _c1$l = function (a0) { return { "form-group-error": a0 }; };
13063
13078
  function WriteCaseLinkFieldComponent_div_1_Template(rf, ctx) {
13064
13079
  if (rf & 1) {
13065
- i0__namespace.ɵɵelementStart(0, "div", 1);
13066
- i0__namespace.ɵɵelementStart(1, "label", 2);
13067
- i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_1_span_2_Template, 3, 3, "span", 3);
13080
+ i0__namespace.ɵɵelementStart(0, "div", 2);
13081
+ i0__namespace.ɵɵelementStart(1, "label", 3);
13082
+ i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_1_span_2_Template, 3, 3, "span", 4);
13068
13083
  i0__namespace.ɵɵelementEnd();
13069
- i0__namespace.ɵɵtemplate(3, WriteCaseLinkFieldComponent_div_1_span_3_Template, 2, 1, "span", 4);
13070
- i0__namespace.ɵɵelement(4, "input", 5);
13084
+ i0__namespace.ɵɵtemplate(3, WriteCaseLinkFieldComponent_div_1_span_3_Template, 2, 1, "span", 5);
13085
+ i0__namespace.ɵɵtemplate(4, WriteCaseLinkFieldComponent_div_1_span_4_Template, 3, 4, "span", 6);
13086
+ i0__namespace.ɵɵelement(5, "input", 7);
13071
13087
  i0__namespace.ɵɵelementEnd();
13072
13088
  }
13073
13089
  if (rf & 2) {
13074
13090
  var ctx_r0 = i0__namespace.ɵɵnextContext();
13091
+ i0__namespace.ɵɵproperty("formGroup", ctx_r0.caseLinkGroup)("ngClass", i0__namespace.ɵɵpureFunction1(8, _c1$l, !ctx_r0.caseReferenceControl.valid && (ctx_r0.caseReferenceControl.dirty || ctx_r0.caseReferenceControl.touched)));
13075
13092
  i0__namespace.ɵɵadvance(1);
13076
- i0__namespace.ɵɵproperty("for", ctx_r0.id());
13093
+ i0__namespace.ɵɵproperty("for", ctx_r0.caseReferenceControl);
13077
13094
  i0__namespace.ɵɵadvance(1);
13078
13095
  i0__namespace.ɵɵproperty("ngIf", ctx_r0.caseField.label);
13079
13096
  i0__namespace.ɵɵadvance(1);
13080
13097
  i0__namespace.ɵɵproperty("ngIf", ctx_r0.caseField.hint_text);
13081
13098
  i0__namespace.ɵɵadvance(1);
13082
- i0__namespace.ɵɵproperty("id", ctx_r0.id())("formControl", ctx_r0.caseReferenceControl);
13099
+ i0__namespace.ɵɵproperty("ngIf", ctx_r0.caseReferenceControl.errors && (ctx_r0.caseReferenceControl.dirty || ctx_r0.caseReferenceControl.touched));
13100
+ i0__namespace.ɵɵadvance(1);
13101
+ i0__namespace.ɵɵproperty("id", ctx_r0.caseReferenceControl)("formControl", ctx_r0.caseReferenceControl);
13083
13102
  }
13084
13103
  }
13085
13104
  function WriteCaseLinkFieldComponent_div_2_Template(rf, ctx) {
13086
13105
  if (rf & 1) {
13087
- var _r5_1 = i0__namespace.ɵɵgetCurrentView();
13088
- i0__namespace.ɵɵelementStart(0, "div", 1);
13089
- i0__namespace.ɵɵelementStart(1, "ccd-write-linked-cases", 8);
13090
- i0__namespace.ɵɵlistener("onLinkedCasesSelected", function WriteCaseLinkFieldComponent_div_2_Template_ccd_write_linked_cases_onLinkedCasesSelected_1_listener() { i0__namespace.ɵɵrestoreView(_r5_1); var ctx_r4 = i0__namespace.ɵɵnextContext(); return ctx_r4.submitLinkedCases(); });
13106
+ var _r6_1 = i0__namespace.ɵɵgetCurrentView();
13107
+ i0__namespace.ɵɵelementStart(0, "div", 11);
13108
+ i0__namespace.ɵɵelementStart(1, "ccd-write-linked-cases", 12);
13109
+ i0__namespace.ɵɵlistener("onLinkedCasesSelected", function WriteCaseLinkFieldComponent_div_2_Template_ccd_write_linked_cases_onLinkedCasesSelected_1_listener() { i0__namespace.ɵɵrestoreView(_r6_1); var ctx_r5 = i0__namespace.ɵɵnextContext(); return ctx_r5.submitLinkedCases(); });
13091
13110
  i0__namespace.ɵɵelementEnd();
13092
13111
  i0__namespace.ɵɵelementEnd();
13093
13112
  }
@@ -13107,32 +13126,72 @@
13107
13126
  }
13108
13127
  WriteCaseLinkFieldComponent.prototype.ngOnInit = function () {
13109
13128
  var e_1, _a;
13110
- this.formArray = this.registerControl(new i2.FormArray([]), true);
13111
- this.formArray['caseField'] = this.caseField;
13112
- if (!this.hasCaseLinkCollection()) {
13113
- this.caseLinkGroup = this.registerControl(new i2.FormGroup({
13114
- CaseReference: new i2.FormControl(this.caseField.value.CaseReference, i2.Validators.required),
13115
- }), true);
13129
+ // Will be TRUE for new Case link/unlink journey
13130
+ this.containsCaseLinkCollection = this.hasCaseLinkCollection();
13131
+ if (!this.containsCaseLinkCollection) {
13132
+ if (this.caseField.value) {
13133
+ this.caseLinkGroup = this.registerControl(new i2.FormGroup({
13134
+ CaseReference: new i2.FormControl(this.caseField.value.CaseReference, i2.Validators.required),
13135
+ }), true);
13136
+ }
13137
+ else {
13138
+ this.caseLinkGroup = this.registerControl(new i2.FormGroup({
13139
+ CaseReference: new i2.FormControl(null, i2.Validators.required),
13140
+ }), true);
13141
+ }
13142
+ this.caseReferenceControl = this.caseLinkGroup.controls['CaseReference'];
13143
+ this.caseReferenceControl.setValidators(this.caseReferenceValidator());
13144
+ // Ensure that all sub-fields inherit the same value for retain_hidden_value as this parent; although a CaseLink
13145
+ // field uses the Complex type, it is meant to be treated as one field
13146
+ if (this.caseField && this.caseField.field_type.type === 'Complex') {
13147
+ try {
13148
+ for (var _b = __values(this.caseField.field_type.complex_fields), _c = _b.next(); !_c.done; _c = _b.next()) {
13149
+ var caseLinkSubField = _c.value;
13150
+ caseLinkSubField.retain_hidden_value = this.caseField.retain_hidden_value;
13151
+ }
13152
+ }
13153
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
13154
+ finally {
13155
+ try {
13156
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
13157
+ }
13158
+ finally { if (e_1) throw e_1.error; }
13159
+ }
13160
+ }
13116
13161
  }
13117
- // Ensure that all sub-fields inherit the same value for retain_hidden_value as this parent; although a CaseLink
13118
- // field uses the Complex type, it is meant to be treated as one field
13119
- if (this.caseField && this.caseField.field_type.type === 'Complex') {
13120
- try {
13121
- for (var _b = __values(this.caseField.field_type.complex_fields), _c = _b.next(); !_c.done; _c = _b.next()) {
13122
- var caseLinkSubField = _c.value;
13123
- caseLinkSubField.retain_hidden_value = this.caseField.retain_hidden_value;
13162
+ };
13163
+ WriteCaseLinkFieldComponent.prototype.caseReferenceValidator = function () {
13164
+ var _this = this;
13165
+ return function (control) {
13166
+ if (control.value) {
13167
+ if (_this.validCaseReference(control.value)) {
13168
+ return null;
13124
13169
  }
13170
+ return { error: 'Please use a valid 16 Digit Case Reference' };
13125
13171
  }
13126
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
13127
- finally {
13128
- try {
13129
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
13172
+ else {
13173
+ if (control.touched) {
13174
+ return { error: 'Please use a valid 16 Digit Case Reference' };
13130
13175
  }
13131
- finally { if (e_1) throw e_1.error; }
13132
13176
  }
13177
+ return null;
13178
+ };
13179
+ };
13180
+ WriteCaseLinkFieldComponent.prototype.validCaseReference = function (valueString) {
13181
+ if (!valueString) {
13182
+ return false;
13133
13183
  }
13134
- this.containsCaseLinkCollection = this.hasCaseLinkCollection();
13184
+ return new RegExp('^\\b\\d{4}[ -]?\\d{4}[ -]?\\d{4}[ -]?\\d{4}\\b$').test(valueString.trim());
13135
13185
  };
13186
+ WriteCaseLinkFieldComponent.prototype.hasCaseLinkCollection = function () {
13187
+ return (this.caseField.field_type &&
13188
+ this.caseField.field_type.type === 'Collection' &&
13189
+ this.caseField.field_type.collection_field_type.id === 'CaseLink' &&
13190
+ this.caseField.id === 'caseLinks');
13191
+ };
13192
+ /**
13193
+ * This method is applicable only for new Case link/unlink journey
13194
+ */
13136
13195
  WriteCaseLinkFieldComponent.prototype.submitLinkedCases = function () {
13137
13196
  var formGroup = this.formGroup;
13138
13197
  if (!this.linkedCasesService.isLinkedCasesEventTrigger) {
@@ -13144,17 +13203,6 @@
13144
13203
  this.formGroup.value.caseLinks = this.linkedCasesService.caseFieldValue;
13145
13204
  }
13146
13205
  };
13147
- WriteCaseLinkFieldComponent.prototype.validCaseReference = function (valueString) {
13148
- if (!valueString) {
13149
- return false;
13150
- }
13151
- return new RegExp('^\\b\\d{4}[ -]?\\d{4}[ -]?\\d{4}[ -]?\\d{4}\\b$').test(valueString.trim());
13152
- };
13153
- WriteCaseLinkFieldComponent.prototype.hasCaseLinkCollection = function () {
13154
- return (this.caseField.field_type &&
13155
- this.caseField.field_type.type === 'Collection' &&
13156
- this.caseField.field_type.collection_field_type.id === 'CaseLink');
13157
- };
13158
13206
  return WriteCaseLinkFieldComponent;
13159
13207
  }(AbstractFieldWriteComponent));
13160
13208
  WriteCaseLinkFieldComponent.ɵfac = function WriteCaseLinkFieldComponent_Factory(t) { return new (t || WriteCaseLinkFieldComponent)(i0__namespace.ɵɵdirectiveInject(LinkedCasesService)); };
@@ -13166,11 +13214,11 @@
13166
13214
  var _t = void 0;
13167
13215
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
13168
13216
  }
13169
- }, inputs: { caseFields: "caseFields", formGroup: "formGroup" }, features: [i0__namespace.ɵɵ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) {
13217
+ }, inputs: { caseFields: "caseFields", formGroup: "formGroup" }, features: [i0__namespace.ɵɵ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) {
13170
13218
  if (rf & 1) {
13171
13219
  i0__namespace.ɵɵelementContainerStart(0);
13172
- i0__namespace.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 5, 5, "div", 0);
13173
- i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 0);
13220
+ i0__namespace.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 6, 10, "div", 0);
13221
+ i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 1);
13174
13222
  i0__namespace.ɵɵelementContainerEnd();
13175
13223
  }
13176
13224
  if (rf & 2) {
@@ -17858,6 +17906,8 @@
17858
17906
  default:
17859
17907
  return write ? WriteComplexFieldComponent : ReadComplexFieldComponent;
17860
17908
  }
17909
+ case 'CaseLink':
17910
+ return write ? WriteCaseLinkFieldComponent : ReadCaseLinkFieldComponent;
17861
17911
  case 'Collection':
17862
17912
  switch (caseField.field_type.collection_field_type.id) {
17863
17913
  case 'CaseLink':
@@ -25511,7 +25561,7 @@
25511
25561
  WriteOrganisationComplexFieldComponent], [i1__namespace.AsyncPipe]);
25512
25562
  i0__namespace.ɵɵsetComponentScope(WriteOrderSummaryFieldComponent, [ReadOrderSummaryFieldComponent], []);
25513
25563
  i0__namespace.ɵɵsetComponentScope(WriteDateContainerFieldComponent, [i1__namespace.NgIf, DatetimePickerComponent, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective, WriteDateFieldComponent], []);
25514
- i0__namespace.ɵɵsetComponentScope(WriteCaseLinkFieldComponent, [i1__namespace.NgIf, i2__namespace.DefaultValueAccessor, i2__namespace.NgControlStatus, i2__namespace.FormControlDirective, WriteLinkedCasesComponent, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective], [FieldLabelPipe]);
25564
+ i0__namespace.ɵɵsetComponentScope(WriteCaseLinkFieldComponent, [i1__namespace.NgIf, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective, i1__namespace.NgClass, i2__namespace.DefaultValueAccessor, i2__namespace.NgControlStatus, i2__namespace.FormControlDirective, WriteLinkedCasesComponent], [FieldLabelPipe, FirstErrorPipe]);
25515
25565
  i0__namespace.ɵɵsetComponentScope(WriteCollectionFieldComponent, [i1__namespace.NgIf, i1__namespace.NgForOf, FieldWriteComponent, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective], [FieldLabelPipe, FirstErrorPipe]);
25516
25566
  i0__namespace.ɵɵsetComponentScope(
25517
25567
  // ComponentLauncher web components