@hmcts/ccd-case-ui-toolkit 6.19.14 → 6.19.15-prerelease-service-id-params

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.
@@ -18764,6 +18764,12 @@
18764
18764
  }
18765
18765
  return rxjs.of(null);
18766
18766
  };
18767
+ CommonDataService.prototype.getServiceOrgData = function (url) {
18768
+ if (url) {
18769
+ return this.http.get(url, { observe: 'body' });
18770
+ }
18771
+ return rxjs.of(null);
18772
+ };
18767
18773
  return CommonDataService;
18768
18774
  }());
18769
18775
  CommonDataService.ɵfac = function CommonDataService_Factory(t) { return new (t || CommonDataService)(i0__namespace.ɵɵinject(i1__namespace$2.HttpClient)); };
@@ -19028,6 +19034,7 @@
19028
19034
  _this.linkedCasesPages = exports.LinkedCasesPages;
19029
19035
  _this.linkedCasesEventTriggers = exports.LinkedCasesEventTriggers;
19030
19036
  _this.linkedCases = [];
19037
+ _this.subscriptions = new rxjs.Subscription();
19031
19038
  return _this;
19032
19039
  }
19033
19040
  WriteLinkedCasesFieldComponent.prototype.ngOnInit = function () {
@@ -19038,17 +19045,17 @@
19038
19045
  // Clear validation errors
19039
19046
  this.caseEditDataService.clearFormValidationErrors();
19040
19047
  // Get linked case reasons from ref data
19041
- this.getLinkedCaseReasons();
19042
19048
  this.linkedCasesService.editMode = false;
19043
- this.caseEditDataService.caseDetails$.subscribe({
19044
- next: function (caseDetails) { return _this.initialiseCaseDetails(caseDetails); }
19045
- });
19046
- this.caseEditDataService.caseEventTriggerName$.subscribe({
19049
+ this.subscriptions.add(this.caseEditDataService.caseDetails$.subscribe({
19050
+ next: function (caseDetails) { _this.initialiseCaseDetails(caseDetails); }
19051
+ }));
19052
+ this.getOrgService();
19053
+ this.subscriptions.add(this.caseEditDataService.caseEventTriggerName$.subscribe({
19047
19054
  next: function (name) { return _this.linkedCasesService.isLinkedCasesEventTrigger = (name === exports.LinkedCasesEventTriggers.LINK_CASES); }
19048
- });
19049
- this.caseEditDataService.caseEditForm$.subscribe({
19055
+ }));
19056
+ this.subscriptions.add(this.caseEditDataService.caseEditForm$.subscribe({
19050
19057
  next: function (editForm) { return _this.caseEditForm = editForm; }
19051
- });
19058
+ }));
19052
19059
  };
19053
19060
  WriteLinkedCasesFieldComponent.prototype.initialiseCaseDetails = function (caseDetails) {
19054
19061
  if (caseDetails) {
@@ -19085,19 +19092,29 @@
19085
19092
  }
19086
19093
  }
19087
19094
  };
19088
- WriteLinkedCasesFieldComponent.prototype.getLinkedCaseReasons = function () {
19095
+ WriteLinkedCasesFieldComponent.prototype.getLinkedCaseReasons = function (serviceId) {
19089
19096
  var _this = this;
19090
- var reasonCodeAPIurl = this.appConfig.getRDCommonDataApiUrl() + "/lov/categories/CaseLinkingReasonCode";
19097
+ var reasonCodeAPIurl = this.appConfig.getRDCommonDataApiUrl() + "/lov/categories/CaseLinkingReasonCode?serviceId=" + serviceId;
19091
19098
  this.commonDataService.getRefData(reasonCodeAPIurl).subscribe({
19092
19099
  next: function (reasons) {
19093
19100
  // Sort in ascending order
19094
19101
  var linkCaseReasons = reasons.list_of_values.sort(function (a, b) { return (a.value_en > b.value_en) ? 1 : -1; });
19095
- // Move Other option to the end of the list
19096
19102
  _this.linkedCasesService.linkCaseReasons = linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.filter(function (reason) { return reason.value_en !== 'Other'; });
19103
+ // Move Other option to the end of the list
19097
19104
  _this.linkedCasesService.linkCaseReasons.push(linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.find(function (reason) { return reason.value_en === 'Other'; }));
19098
19105
  }
19099
19106
  });
19100
19107
  };
19108
+ WriteLinkedCasesFieldComponent.prototype.getOrgService = function () {
19109
+ var _this = this;
19110
+ var _a, _b;
19111
+ var servicesApiUrl = "refdata/location/orgServices?ccdCaseType=" + ((_b = (_a = this.caseDetails) === null || _a === void 0 ? void 0 : _a.case_type) === null || _b === void 0 ? void 0 : _b.id);
19112
+ this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe(function (result) {
19113
+ result.forEach(function (ids) {
19114
+ _this.getLinkedCaseReasons(ids.service_id);
19115
+ });
19116
+ });
19117
+ };
19101
19118
  WriteLinkedCasesFieldComponent.prototype.proceedToNextPage = function () {
19102
19119
  if (this.isAtFinalPage()) {
19103
19120
  // Continue button event must be allowed in final page
@@ -19138,8 +19155,8 @@
19138
19155
  var _this = this;
19139
19156
  this.casesService.getCaseViewV2(this.linkedCasesService.caseId).subscribe(function (caseView) {
19140
19157
  var caseViewFiltered = caseView.tabs.filter(function (tab) {
19141
- return tab.fields.some(function (_b) {
19142
- var field_type = _b.field_type;
19158
+ return tab.fields.some(function (_c) {
19159
+ var field_type = _c.field_type;
19143
19160
  return field_type && field_type.collection_field_type && field_type.collection_field_type.id === 'CaseLink';
19144
19161
  });
19145
19162
  });
@@ -19156,6 +19173,9 @@
19156
19173
  : exports.LinkedCasesPages.NO_LINKED_CASES;
19157
19174
  });
19158
19175
  };
19176
+ WriteLinkedCasesFieldComponent.prototype.ngOnDestroy = function () {
19177
+ this.subscriptions.unsubscribe();
19178
+ };
19159
19179
  return WriteLinkedCasesFieldComponent;
19160
19180
  }(AbstractFieldWriteComponent));
19161
19181
  WriteLinkedCasesFieldComponent.ɵfac = function WriteLinkedCasesFieldComponent_Factory(t) { return new (t || WriteLinkedCasesFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CommonDataService), i0__namespace.ɵɵdirectiveInject(CasesService), i0__namespace.ɵɵdirectiveInject(LinkedCasesService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
@@ -27838,7 +27858,7 @@
27838
27858
  var _d;
27839
27859
  return Object.assign(o, (_d = {}, _d[key.id] = key.value, _d));
27840
27860
  }, {});
27841
- this.allFieldsValues = Object.assign(this.metadataFieldsObject, this.editForm.getRawValue().data);
27861
+ this.allFieldsValues = Object.assign(this.metadataFieldsObject ? this.metadataFieldsObject : {}, this.editForm.getRawValue().data);
27842
27862
  // Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
27843
27863
  // a FlagLauncher field in the event trigger
27844
27864
  this.caseEdit.isCaseFlagSubmission =