@hmcts/ccd-case-ui-toolkit 7.3.62-fix-case-filter-issue → 7.3.63

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.
@@ -8915,9 +8915,14 @@ class CaseEditWizardGuard {
8915
8915
  }
8916
8916
  goToFirst(wizard, canShowPredicate, route) {
8917
8917
  const firstPage = wizard.firstPage(canShowPredicate);
8918
- // If there’s no specific wizard page called, it makes another navigation to either the first page available or to the submit page
8919
- // TODO should find a way to navigate to target page without going through the whole loop (and make a second call to BE) again
8920
- return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], { queryParams: route.queryParams });
8918
+ // This route transition is an internal wizard redirect used to append the first page id to the URL.
8919
+ // Mark it in navigation state so EventStartGuard can skip duplicate work allocation checks.
8920
+ return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], {
8921
+ queryParams: route.queryParams,
8922
+ state: {
8923
+ [EVENT_START_FIRST_PAGE_REDIRECT]: true
8924
+ }
8925
+ });
8921
8926
  }
8922
8927
  goToSubmit(route) {
8923
8928
  return this.router.navigate([...this.parentUrlSegments(route), 'submit'], { queryParams: route.queryParams });
@@ -10140,6 +10145,7 @@ class CaseEditComponent {
10140
10145
  }] }); })();
10141
10146
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 39 }); })();
10142
10147
 
10148
+ const EVENT_START_FIRST_PAGE_REDIRECT = 'eventStartFirstPageRedirect';
10143
10149
  function convertNonASCIICharacter(character) {
10144
10150
  if (character === '£') {
10145
10151
  // pound sign will be frequently used and works for btoa despite being non-ASCII
@@ -11528,7 +11534,7 @@ class CaseEditPageComponent {
11528
11534
  CaseEditPageComponent.setFocusToTop();
11529
11535
  }
11530
11536
  // Adding validation message to show it as Error Summary
11531
- generateErrorMessage(fields, container, path) {
11537
+ generateErrorMessage(fields, container, path, sourceFromComplexField) {
11532
11538
  const group = container || this.editForm.controls['data'];
11533
11539
  let validErrorFieldFound = false;
11534
11540
  let validationErrorAmount = this.validationErrors.length;
@@ -11545,7 +11551,7 @@ class CaseEditPageComponent {
11545
11551
  if (fieldElement) {
11546
11552
  const label = casefield.label || 'Field';
11547
11553
  let id = casefield.id;
11548
- if (fieldElement['component'] && fieldElement['component'].parent) {
11554
+ if (fieldElement['component'] && (fieldElement['component'].parent || sourceFromComplexField)) {
11549
11555
  if (fieldElement['component'].idPrefix.indexOf(`_${id}_`) === -1) {
11550
11556
  id = `${fieldElement['component'].idPrefix}${id}`;
11551
11557
  }
@@ -11557,7 +11563,7 @@ class CaseEditPageComponent {
11557
11563
  if (casefield.id === 'AddressLine1') {
11558
11564
  // EUI-1067 - Display more relevant error message to user and correctly navigate to the field
11559
11565
  this.addressService.setMandatoryError(true);
11560
- this.caseEditDataService.addFormValidationError({ id: `${path}_${path}`, message: `An address is required` });
11566
+ this.caseEditDataService.addFormValidationError({ id, message: `An address is required` });
11561
11567
  }
11562
11568
  else {
11563
11569
  this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
@@ -11583,7 +11589,7 @@ class CaseEditPageComponent {
11583
11589
  }
11584
11590
  else if (fieldElement.invalid) {
11585
11591
  if (casefield.isComplex()) {
11586
- errorPresent = this.generateErrorMessage(casefield.field_type.complex_fields, fieldElement, id);
11592
+ errorPresent = this.generateErrorMessage(casefield.field_type.complex_fields, fieldElement, id, true);
11587
11593
  }
11588
11594
  else if (casefield.isCollection() && casefield.field_type.collection_field_type.type === 'Complex') {
11589
11595
  const fieldArray = fieldElement;
@@ -15355,9 +15361,20 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
15355
15361
  }
15356
15362
  }
15357
15363
  focusLastItem() {
15358
- const item = this.items.last.nativeElement.querySelector('.form-control');
15359
- if (item) {
15360
- item.focus();
15364
+ const root = this.items.last?.nativeElement;
15365
+ if (!root) {
15366
+ return;
15367
+ }
15368
+ const controls = Array.from(root.querySelectorAll('.form-control'));
15369
+ const focusTarget = controls.find(control => {
15370
+ if (!(control instanceof HTMLInputElement)) {
15371
+ return true;
15372
+ }
15373
+ const type = (control.type || '').toLowerCase();
15374
+ return type !== 'radio';
15375
+ });
15376
+ if (focusTarget) {
15377
+ focusTarget.focus();
15361
15378
  }
15362
15379
  }
15363
15380
  removeItem(index) {
@@ -19976,12 +19993,18 @@ class MoneyGbpInputComponent {
19976
19993
  writeValue(obj) {
19977
19994
  if (obj) {
19978
19995
  this.rawValue = obj;
19979
- const integerPart = obj.slice(0, -2) || '0';
19980
- let decimalPart = obj.slice(-2);
19981
- while (2 > decimalPart.length) {
19982
- decimalPart += '0';
19996
+ // If already contains decimal, use it directly
19997
+ if (obj.includes('.')) {
19998
+ this.displayValue = obj;
19999
+ }
20000
+ else {
20001
+ const integerPart = obj.slice(0, -2) || '0';
20002
+ let decimalPart = obj.slice(-2);
20003
+ while (2 > decimalPart.length) {
20004
+ decimalPart += '0';
20005
+ }
20006
+ this.displayValue = [integerPart, decimalPart].join('.');
19983
20007
  }
19984
- this.displayValue = [integerPart, decimalPart].join('.');
19985
20008
  }
19986
20009
  }
19987
20010
  registerOnChange(fn) {
@@ -34507,7 +34530,6 @@ class WorkbasketFiltersComponent {
34507
34530
  }
34508
34531
  }
34509
34532
  onJurisdictionIdChange() {
34510
- this.clearStoredWorkbasketFilterValues();
34511
34533
  if (this.selected.jurisdiction) {
34512
34534
  this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
34513
34535
  this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes.length > 0
@@ -34522,7 +34544,7 @@ class WorkbasketFiltersComponent {
34522
34544
  this.selected.caseState = null;
34523
34545
  this.clearWorkbasketInputs();
34524
34546
  if (!this.isApplyButtonDisabled()) {
34525
- this.onCaseTypeIdChange(false);
34547
+ this.onCaseTypeIdChange();
34526
34548
  }
34527
34549
  }
34528
34550
  else {
@@ -34530,10 +34552,7 @@ class WorkbasketFiltersComponent {
34530
34552
  this.resetCaseState();
34531
34553
  }
34532
34554
  }
34533
- onCaseTypeIdChange(clearStoredValues = true) {
34534
- if (clearStoredValues) {
34535
- this.clearStoredWorkbasketFilterValues();
34536
- }
34555
+ onCaseTypeIdChange() {
34537
34556
  if (this.selected.caseType) {
34538
34557
  this.selectedCaseTypeStates = this.sortStates(this.selected.caseType.states);
34539
34558
  this.selected.caseState = null;
@@ -34629,7 +34648,7 @@ class WorkbasketFiltersComponent {
34629
34648
  this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes;
34630
34649
  this.selected.caseType = this.selectCaseType(this.selected, this.selectedJurisdictionCaseTypes, routeSnapshot);
34631
34650
  if (this.selected.caseType) {
34632
- this.onCaseTypeIdChange(false);
34651
+ this.onCaseTypeIdChange();
34633
34652
  this.selected.caseState = this.selectCaseState(this.selected.caseType, routeSnapshot);
34634
34653
  }
34635
34654
  this.workbasketDefaults = true;
@@ -34676,9 +34695,6 @@ class WorkbasketFiltersComponent {
34676
34695
  this.workbasketInputsReady = false;
34677
34696
  this.workbasketInputs = [];
34678
34697
  }
34679
- clearStoredWorkbasketFilterValues() {
34680
- this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
34681
- }
34682
34698
  resetCaseState() {
34683
34699
  this.defaults.state_id = null;
34684
34700
  this.selected.caseState = null;
@@ -37925,6 +37941,10 @@ class EventStartGuard {
37925
37941
  }
37926
37942
  }
37927
37943
  return caseDataObservable.pipe(switchMap(() => {
37944
+ if (this.shouldSkipDuplicateWorkAllocationCall()) {
37945
+ this.abstractConfig.logMessage(`EventStartGuard: skipping duplicate work allocation call for caseId ${caseId} and eventId ${eventId}`);
37946
+ return of(true);
37947
+ }
37928
37948
  if (this.jurisdiction && this.caseType) {
37929
37949
  if (this.caseId === caseId) {
37930
37950
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, this.caseType, this.jurisdiction)
@@ -37938,6 +37958,9 @@ class EventStartGuard {
37938
37958
  return of(false);
37939
37959
  }));
37940
37960
  }
37961
+ shouldSkipDuplicateWorkAllocationCall() {
37962
+ return this.router.getCurrentNavigation()?.extras?.state?.[EVENT_START_FIRST_PAGE_REDIRECT] === true;
37963
+ }
37941
37964
  checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId) {
37942
37965
  if (!payload || !payload.tasks) {
37943
37966
  return true;