@hmcts/ccd-case-ui-toolkit 7.0.33-dynamic-multi-list-fix → 7.0.33-fix-service-code-api

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.
@@ -3043,9 +3043,7 @@ class CaseField {
3043
3043
  }
3044
3044
  }
3045
3045
  set list_items(items) {
3046
- if ((items && !this._list_items) || (items?.length > this._list_items?.length)) {
3047
- this._list_items = items;
3048
- }
3046
+ this._list_items = items;
3049
3047
  }
3050
3048
  get dateTimeEntryFormat() {
3051
3049
  if (this.isComplexDisplay()) {
@@ -5218,8 +5216,7 @@ class FieldTypeSanitiser {
5218
5216
  if (!data || !caseFields) {
5219
5217
  return;
5220
5218
  }
5221
- caseFields = this.ensureDynamicMultiSelectListPopulated(caseFields);
5222
- caseFields.forEach((caseField) => {
5219
+ caseFields.forEach(caseField => {
5223
5220
  // tslint:disable-next-line:switch-default
5224
5221
  switch (caseField.field_type.type) {
5225
5222
  case FieldTypeSanitiser.FIELD_TYPE_DYNAMIC_MULTISELECT_LIST:
@@ -5242,16 +5239,6 @@ class FieldTypeSanitiser {
5242
5239
  }
5243
5240
  });
5244
5241
  }
5245
- ensureDynamicMultiSelectListPopulated(caseFields) {
5246
- return caseFields.map((field) => {
5247
- if (field.field_type.type !== 'Complex') {
5248
- return field;
5249
- }
5250
- const complexFieldsUpdated = field.field_type.complex_fields.map((complexField) => complexField.field_type.type === FieldTypeSanitiser.FIELD_TYPE_DYNAMIC_MULTISELECT_LIST && complexField.display_context !== 'HIDDEN' && field._value?.[complexField.id]
5251
- ? { ...complexField, list_items: field._value[complexField.id]?.list_items } : complexField);
5252
- return { ...field, field_type: { ...field.field_type, complex_fields: complexFieldsUpdated } };
5253
- });
5254
- }
5255
5242
  convertArrayToDynamicListOutput(field, data) {
5256
5243
  const values = data[field.id];
5257
5244
  if (Array.isArray(values)) {
@@ -16963,20 +16950,20 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
16963
16950
  getLinkedCaseReasons(serviceId) {
16964
16951
  const reasonCodeAPIurl = `${this.appConfig.getRDCommonDataApiUrl()}/lov/categories/CaseLinkingReasonCode?serviceId=${serviceId}`;
16965
16952
  this.commonDataService.getRefData(reasonCodeAPIurl).subscribe({
16966
- next: reasons => {
16953
+ next: (reasons) => {
16967
16954
  // Sort in ascending order
16968
16955
  const linkCaseReasons = reasons.list_of_values.sort((a, b) => (a.value_en > b.value_en) ? 1 : -1);
16969
- this.linkedCasesService.linkCaseReasons = linkCaseReasons?.filter(reason => reason.value_en !== 'Other');
16956
+ this.linkedCasesService.linkCaseReasons = linkCaseReasons?.filter((reason) => reason.value_en !== 'Other');
16970
16957
  // Move Other option to the end of the list
16971
- this.linkedCasesService.linkCaseReasons.push(linkCaseReasons?.find(reason => reason.value_en === 'Other'));
16958
+ this.linkedCasesService.linkCaseReasons.push(linkCaseReasons?.find((reason) => reason.value_en === 'Other'));
16972
16959
  }
16973
16960
  });
16974
16961
  }
16975
16962
  getOrgService() {
16976
16963
  const servicesApiUrl = `refdata/location/orgServices?ccdCaseType=${this.caseDetails?.case_type?.id}`;
16977
- this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe(result => {
16978
- result.forEach(ids => {
16979
- this.getLinkedCaseReasons(ids.service_id);
16964
+ this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe((result) => {
16965
+ result.forEach((ids) => {
16966
+ this.getLinkedCaseReasons(ids.service_code);
16980
16967
  });
16981
16968
  });
16982
16969
  }