@hmcts/ccd-case-ui-toolkit 7.0.10 → 7.0.11-manual-caseflag-lang

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.
@@ -11788,7 +11788,7 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
11788
11788
  // Extract all flags-related data from the CaseEventTrigger object in the snapshot data
11789
11789
  if (this.route.snapshot.data.eventTrigger) {
11790
11790
  // Get the HMCTSServiceId from supplementary data, if it exists (required for retrieving the available flag types in
11791
- // the first instance, only falling back on case type ID or jurisidiction if it's not present)
11791
+ // the first instance, only falling back on case type ID or jurisdiction if it's not present)
11792
11792
  if (this.route.snapshot.data.eventTrigger.supplementary_data
11793
11793
  && this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId) {
11794
11794
  this.hmctsServiceId = this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId;
@@ -12129,32 +12129,36 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
12129
12129
  this.flagCommentsOptional = true;
12130
12130
  }
12131
12131
  populateNewFlagDetailInstance() {
12132
+ const langSearchTerm = this.caseFlagParentFormGroup?.value['languageSearchTerm'];
12133
+ const manualLangEntry = this.caseFlagParentFormGroup?.value['manualLanguageEntry'];
12134
+ const flagType = this.caseFlagParentFormGroup?.value['flagType'];
12135
+ const otherDesc = this.caseFlagParentFormGroup?.value['otherDescription'];
12132
12136
  const formValues = this.caseFlagParentFormGroup?.value;
12133
12137
  return {
12134
- name: formValues?.flagType?.name,
12135
- name_cy: formValues?.flagType?.name_cy,
12138
+ name: this.flagType?.name,
12139
+ name_cy: flagType?.name_cy,
12136
12140
  // Currently, subTypeValue, subTypeValue_cy and subTypeKey are applicable only to language flag types
12137
- subTypeValue: formValues?.languageSearchTerm && this.rpxTranslationService.language === 'en'
12138
- ? formValues?.languageSearchTerm.value
12139
- : formValues?.manualLanguageEntry && this.rpxTranslationService.language === 'en'
12140
- ? formValues?.manualLanguageEntry
12141
+ subTypeValue: langSearchTerm && this.rpxTranslationService.language === 'en'
12142
+ ? langSearchTerm.value
12143
+ : manualLangEntry && this.rpxTranslationService.language === 'en'
12144
+ ? manualLangEntry
12141
12145
  : null,
12142
- subTypeValue_cy: formValues?.languageSearchTerm && this.rpxTranslationService.language === 'cy'
12143
- ? formValues?.languageSearchTerm.value_cy
12144
- : formValues?.manualLanguageEntry && this.rpxTranslationService.language === 'cy'
12145
- ? formValues?.manualLanguageEntry
12146
+ subTypeValue_cy: langSearchTerm && this.rpxTranslationService.language === 'cy'
12147
+ ? langSearchTerm?.value_cy
12148
+ : manualLangEntry && this.rpxTranslationService.language === 'cy'
12149
+ ? manualLangEntry
12146
12150
  : null,
12147
12151
  // For user-entered (i.e. non-Reference Data) languages, there is no key
12148
- subTypeKey: formValues?.languageSearchTerm
12149
- ? formValues?.languageSearchTerm.key
12152
+ subTypeKey: langSearchTerm
12153
+ ? langSearchTerm.key
12150
12154
  : null,
12151
- otherDescription: formValues?.flagType?.flagCode === this.otherFlagTypeCode &&
12152
- formValues?.otherDescription && this.rpxTranslationService.language === 'en'
12153
- ? formValues?.otherDescription
12155
+ otherDescription: flagType?.flagCode === this.otherFlagTypeCode &&
12156
+ otherDesc && this.rpxTranslationService.language === 'en'
12157
+ ? otherDesc
12154
12158
  : null,
12155
- otherDescription_cy: formValues?.flagType?.flagCode === this.otherFlagTypeCode &&
12156
- formValues?.otherDescription && this.rpxTranslationService.language === 'cy'
12157
- ? formValues?.otherDescription
12159
+ otherDescription_cy: flagType?.flagCode === this.otherFlagTypeCode &&
12160
+ otherDesc && this.rpxTranslationService.language === 'cy'
12161
+ ? otherDesc
12158
12162
  : null,
12159
12163
  flagComment: this.rpxTranslationService.language === 'en'
12160
12164
  ? formValues?.flagComments
@@ -12164,18 +12168,18 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
12164
12168
  : null,
12165
12169
  flagUpdateComment: formValues?.statusReason,
12166
12170
  dateTimeCreated: new Date().toISOString(),
12167
- path: formValues?.flagType?.Path &&
12168
- formValues?.flagType?.Path.map(pathValue => Object.assign({ id: null, value: pathValue })),
12169
- hearingRelevant: formValues?.flagType?.hearingRelevant ? 'Yes' : 'No',
12170
- flagCode: formValues?.flagType?.flagCode,
12171
+ path: flagType?.Path &&
12172
+ flagType?.Path.map(pathValue => Object.assign({ id: null, value: pathValue })),
12173
+ hearingRelevant: flagType?.hearingRelevant ? 'Yes' : 'No',
12174
+ flagCode: flagType?.flagCode,
12171
12175
  // Status should be set to whatever the default is for this flag type, if flag is being created by an external
12172
12176
  // user, otherwise it should be set to "Active" if Case Flags v2.1 is NOT enabled, or the selected status if it is
12173
12177
  status: this.isDisplayContextParameterExternal
12174
- ? formValues?.flagType?.defaultStatus
12178
+ ? flagType?.defaultStatus
12175
12179
  : !this.isDisplayContextParameter2Point1Enabled
12176
12180
  ? CaseFlagStatus.ACTIVE
12177
12181
  : CaseFlagStatus[formValues?.selectedStatus],
12178
- availableExternally: formValues?.flagType?.externallyAvailable ? 'Yes' : 'No'
12182
+ availableExternally: flagType?.externallyAvailable ? 'Yes' : 'No'
12179
12183
  };
12180
12184
  }
12181
12185
  moveToFinalReviewStage() {