@hmcts/ccd-case-ui-toolkit 7.0.65-ungrey-back-button-3 → 7.0.66-ungrey-back-button

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.
Files changed (55) hide show
  1. package/esm2022/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +60 -22
  2. package/esm2022/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.mjs +3 -2
  3. package/esm2022/lib/shared/components/case-editor/case-editor.module.mjs +1 -1
  4. package/esm2022/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.mjs +40 -28
  5. package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.mjs +18 -17
  6. package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +27 -37
  7. package/esm2022/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.mjs +1 -1
  8. package/esm2022/lib/shared/components/case-editor/domain/event-completion-task-states.model.mjs +6 -0
  9. package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +11 -5
  10. package/esm2022/lib/shared/components/case-editor/services/work-allocation.service.mjs +1 -1
  11. package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +28 -5
  12. package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +15 -1
  13. package/esm2022/lib/shared/components/palette/linked-cases/components/unlink-cases/unlink-cases.component.mjs +4 -1
  14. package/esm2022/lib/shared/components/palette/linked-cases/services/linked-cases.service.mjs +2 -1
  15. package/esm2022/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.mjs +2 -1
  16. package/esm2022/lib/shared/components/palette/palette.module.mjs +5 -1
  17. package/esm2022/lib/shared/domain/journey/journey.model.mjs +1 -1
  18. package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
  19. package/esm2022/lib/shared/domain/work-allocation/task-response.model.mjs +1 -1
  20. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +250 -146
  21. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  22. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +5 -2
  23. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  24. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  25. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  26. package/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.d.ts +5 -3
  27. package/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.d.ts.map +1 -1
  28. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.d.ts +7 -5
  29. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.d.ts.map +1 -1
  30. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts +7 -11
  31. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts.map +1 -1
  32. package/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.d.ts +1 -1
  33. package/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.d.ts.map +1 -1
  34. package/lib/shared/components/case-editor/domain/event-completion-task-states.model.d.ts +5 -0
  35. package/lib/shared/components/case-editor/domain/event-completion-task-states.model.d.ts.map +1 -0
  36. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
  37. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts +2 -2
  38. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts.map +1 -1
  39. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
  40. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
  41. package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
  42. package/lib/shared/components/palette/linked-cases/components/unlink-cases/unlink-cases.component.d.ts.map +1 -1
  43. package/lib/shared/components/palette/linked-cases/services/linked-cases.service.d.ts +1 -0
  44. package/lib/shared/components/palette/linked-cases/services/linked-cases.service.d.ts.map +1 -1
  45. package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts.map +1 -1
  46. package/lib/shared/domain/journey/journey.model.d.ts +1 -0
  47. package/lib/shared/domain/journey/journey.model.d.ts.map +1 -1
  48. package/lib/shared/domain/work-allocation/Task.d.ts +10 -1
  49. package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
  50. package/lib/shared/domain/work-allocation/task-response.model.d.ts +1 -1
  51. package/lib/shared/domain/work-allocation/task-response.model.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/esm2022/lib/shared/components/case-editor/domain/event-completion-portal-types.model.mjs +0 -6
  54. package/lib/shared/components/case-editor/domain/event-completion-portal-types.model.d.ts +0 -5
  55. package/lib/shared/components/case-editor/domain/event-completion-portal-types.model.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, EventEmitter, Output, NgModule, ViewEncapsulation, forwardRef, Pipe, ViewChildren, ContentChildren, Injectable, Inject, ChangeDetectorRef, Directive, InjectionToken, Injector, ViewChild, HostListener, ViewContainerRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { Component, Input, EventEmitter, Output, NgModule, ViewEncapsulation, forwardRef, Pipe, ViewChildren, ContentChildren, Injectable, Inject, ChangeDetectorRef, Directive, InjectionToken, ViewChild, HostListener, Injector, ViewContainerRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
3
  import * as i5 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT, AsyncPipe, CurrencyPipe, formatDate } from '@angular/common';
5
5
  import * as i1 from 'rpx-xui-translation';
@@ -24,7 +24,6 @@ import { StateMachine } from '@edium/fsm';
24
24
  import * as i1$3 from '@angular/material/legacy-dialog';
25
25
  import { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogModule } from '@angular/material/legacy-dialog';
26
26
  import { MatDialogConfig } from '@angular/material/dialog';
27
- import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
28
27
  import * as i2 from '@nicky-lenaers/ngx-scroll-to';
29
28
  import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
30
29
  import * as marked from 'marked';
@@ -53,6 +52,7 @@ import * as i15 from '@angular/material/legacy-input';
53
52
  import { MatLegacyInputModule } from '@angular/material/legacy-input';
54
53
  import * as i14 from '@hmcts/media-viewer';
55
54
  import { MediaViewerModule } from '@hmcts/media-viewer';
55
+ import { PortalModule } from '@angular/cdk/portal';
56
56
  import * as i2$3 from 'ngx-pagination';
57
57
  import { NgxPaginationModule, PaginatePipe } from 'ngx-pagination';
58
58
  import * as i10 from '@angular/material/legacy-tabs';
@@ -8823,11 +8823,11 @@ var TaskState;
8823
8823
  TaskState["PendingReConfiguration"] = "PENDING_RECONFIGURATION";
8824
8824
  })(TaskState || (TaskState = {}));
8825
8825
 
8826
- var EventCompletionPortalTypes;
8827
- (function (EventCompletionPortalTypes) {
8828
- EventCompletionPortalTypes[EventCompletionPortalTypes["TaskCancelled"] = 0] = "TaskCancelled";
8829
- EventCompletionPortalTypes[EventCompletionPortalTypes["TaskReassigned"] = 1] = "TaskReassigned";
8830
- })(EventCompletionPortalTypes || (EventCompletionPortalTypes = {}));
8826
+ var EventCompletionTaskStates;
8827
+ (function (EventCompletionTaskStates) {
8828
+ EventCompletionTaskStates[EventCompletionTaskStates["TaskCancelled"] = 0] = "TaskCancelled";
8829
+ EventCompletionTaskStates[EventCompletionTaskStates["TaskReassigned"] = 1] = "TaskReassigned";
8830
+ })(EventCompletionTaskStates || (EventCompletionTaskStates = {}));
8831
8831
 
8832
8832
  const EVENT_COMPLETION_STATE_MACHINE = 'EVENT COMPLETION STATE MACHINE';
8833
8833
  class EventCompletionStateMachineService {
@@ -8866,6 +8866,7 @@ class EventCompletionStateMachineService {
8866
8866
  this.addTransitionsForStateTaskUnassigned();
8867
8867
  }
8868
8868
  entryActionForStateCheckTasksCanBeCompleted(state, context) {
8869
+ const assignNeeded = context.sessionStorageService.getItem('assignNeeded');
8869
8870
  context.workAllocationService.getTask(context.task.id).subscribe(taskResponse => {
8870
8871
  if (taskResponse && taskResponse.task && taskResponse.task.task_state) {
8871
8872
  switch (taskResponse.task.task_state.toUpperCase()) {
@@ -8885,6 +8886,11 @@ class EventCompletionStateMachineService {
8885
8886
  // Task still assigned to current user, complete event and task
8886
8887
  state.trigger(EventCompletionStates.CompleteEventAndTask);
8887
8888
  }
8889
+ else if (assignNeeded === 'true - override') {
8890
+ // this will treat task as unassigned instead of reassigned to complete after user confirmation
8891
+ // assignNeeded will also be immediately overwritten to true
8892
+ state.trigger(EventCompletionStates.TaskUnassigned);
8893
+ }
8888
8894
  else {
8889
8895
  // Task has been reassigned to another user, display error message
8890
8896
  context.reassignedTask = taskResponse.task;
@@ -8906,7 +8912,7 @@ class EventCompletionStateMachineService {
8906
8912
  // Trigger final state to complete processing of state machine
8907
8913
  state.trigger(EventCompletionStates.Final);
8908
8914
  // Load case event completion task cancelled component
8909
- context.component.showPortal(EventCompletionPortalTypes.TaskCancelled);
8915
+ context.component.setTaskState(EventCompletionTaskStates.TaskCancelled);
8910
8916
  }
8911
8917
  entryActionForStateCompleteEventAndTask(state, context) {
8912
8918
  // Trigger final state to complete processing of state machine
@@ -8927,7 +8933,7 @@ class EventCompletionStateMachineService {
8927
8933
  // Trigger final state to complete processing of state machine
8928
8934
  state.trigger(EventCompletionStates.Final);
8929
8935
  // Load case event completion task reassigned component
8930
- context.component.showPortal(EventCompletionPortalTypes.TaskReassigned);
8936
+ context.component.setTaskState(EventCompletionTaskStates.TaskReassigned);
8931
8937
  }
8932
8938
  entryActionForStateTaskUnassigned(state, context) {
8933
8939
  // Trigger final state to complete processing of state machine
@@ -9492,15 +9498,22 @@ class CaseEditComponent {
9492
9498
  const clientContextStr = this.sessionStorageService.getItem('clientContext');
9493
9499
  const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9494
9500
  const taskInSessionStorage = userTask ? userTask.task_data : null;
9495
- let taskEventInSessionStorage;
9496
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
9497
- const taskEventStr = this.sessionStorageService.getItem('taskEvent');
9498
- if (taskEventStr) {
9499
- taskEventInSessionStorage = JSON.parse(taskEventStr);
9501
+ let taskEventCompletionInfo;
9502
+ let userInfo;
9503
+ const taskEventCompletionStr = this.sessionStorageService.getItem('taskEventCompletionInfo');
9504
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
9505
+ const assignNeeded = this.sessionStorageService.getItem('assignNeeded');
9506
+ if (taskEventCompletionStr) {
9507
+ taskEventCompletionInfo = JSON.parse(taskEventCompletionStr);
9508
+ }
9509
+ if (userInfoStr) {
9510
+ userInfo = JSON.parse(userInfoStr);
9500
9511
  }
9501
9512
  const eventId = this.getEventId(form);
9502
9513
  const caseId = this.getCaseId(caseDetails);
9503
- if (this.taskExistsForThisEventAndCase(taskInSessionStorage, taskEventInSessionStorage, eventId, caseId)) {
9514
+ const userId = userInfo.id ? userInfo.id : userInfo.uid;
9515
+ const eventDetails = { eventId, caseId, userId, assignNeeded };
9516
+ if (this.taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails)) {
9504
9517
  this.abstractConfig.logMessage(`task exist for this event for caseId and eventId as ${caseId} ${eventId}`);
9505
9518
  // Show event completion component to perform event completion checks
9506
9519
  this.eventCompletionParams = ({
@@ -9508,9 +9521,16 @@ class CaseEditComponent {
9508
9521
  eventId,
9509
9522
  task: taskInSessionStorage
9510
9523
  });
9511
- // add taskEvent to link current event with task id
9512
- const taskEvent = { eventId, taskId: taskInSessionStorage.id };
9513
- this.sessionStorageService.setItem('taskEvent', JSON.stringify(taskEvent));
9524
+ // add taskEventCompletionInfo again to ensure link current event with task id
9525
+ // note: previous usage was created here so this is to ensure correct functionality continues
9526
+ const taskEventCompletionInfo = {
9527
+ caseId,
9528
+ eventId,
9529
+ userId,
9530
+ taskId: taskInSessionStorage.id,
9531
+ createdTimestamp: Date.now()
9532
+ };
9533
+ this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
9514
9534
  this.isEventCompletionChecksRequired = true;
9515
9535
  }
9516
9536
  else {
@@ -9675,9 +9695,9 @@ class CaseEditComponent {
9675
9695
  return this.postCompleteTaskIfRequired();
9676
9696
  }), finalize(() => {
9677
9697
  this.loadingService.unregister(loadingSpinnerToken);
9678
- // on event completion ensure the previous event taskToComplete/taskEvent removed
9679
- this.sessionStorageService.removeItem('taskToComplete');
9680
- this.sessionStorageService.removeItem('taskEvent');
9698
+ // on event completion ensure the previous event clientContext/taskEventCompletionInfo removed
9699
+ this.sessionStorageService.removeItem('clientContext');
9700
+ this.sessionStorageService.removeItem('taskEventCompletionInfo');
9681
9701
  this.isSubmitting = false;
9682
9702
  }))
9683
9703
  .subscribe(() => {
@@ -9738,22 +9758,32 @@ class CaseEditComponent {
9738
9758
  return null;
9739
9759
  }
9740
9760
  }
9741
- // checks whether current taskToComplete relevant for the event
9742
- taskExistsForThisEventAndCase(taskInSessionStorage, taskEvent, eventId, caseId) {
9743
- if (!taskInSessionStorage || taskInSessionStorage.case_id !== caseId) {
9761
+ // checks whether current clientContext relevant for the event
9762
+ taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails) {
9763
+ if (!taskInSessionStorage || taskInSessionStorage.case_id !== eventDetails.caseId) {
9744
9764
  return false;
9745
9765
  }
9746
- if (!taskEvent) {
9766
+ if (!taskEventCompletionInfo) {
9747
9767
  // if no task event present then there is no task to complete from previous event present
9748
9768
  return true;
9749
9769
  }
9750
9770
  else {
9751
- if (taskEvent.taskId === taskInSessionStorage.id && taskEvent.eventId !== eventId) {
9771
+ if (taskEventCompletionInfo.taskId !== taskInSessionStorage.id) {
9772
+ return true;
9773
+ }
9774
+ else if ((taskEventCompletionInfo.taskId === taskInSessionStorage.id &&
9775
+ this.eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails))
9776
+ || this.eventMoreThanDayAgo(taskEventCompletionInfo.createdTimestamp)) {
9752
9777
  // if the session storage not related to event, ignore it and remove
9753
- this.sessionStorageService.removeItem('taskToComplete');
9754
- this.sessionStorageService.removeItem('taskEvent');
9778
+ this.sessionStorageService.removeItem('clientContext');
9779
+ this.sessionStorageService.removeItem('taskEventCompletionInfo');
9755
9780
  return false;
9756
9781
  }
9782
+ if (eventDetails.assignNeeded === 'false' && eventDetails.userId !== taskInSessionStorage.assignee) {
9783
+ // if the user does not match task assignee, assign is now needed
9784
+ // data cannot be deleted and ignored as it matches understanding
9785
+ this.sessionStorageService.setItem('assignNeeded', 'true');
9786
+ }
9757
9787
  return true;
9758
9788
  }
9759
9789
  }
@@ -9774,6 +9804,20 @@ class CaseEditComponent {
9774
9804
  hasCallbackFailed(response) {
9775
9805
  return response['callback_response_status'] !== 'CALLBACK_COMPLETED';
9776
9806
  }
9807
+ eventMoreThanDayAgo(timestamp) {
9808
+ if ((new Date().getTime() - timestamp) > (24 * 60 * 60 * 1000)) {
9809
+ return true;
9810
+ }
9811
+ return false;
9812
+ }
9813
+ eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails) {
9814
+ if (taskEventCompletionInfo.eventId !== eventDetails.eventId
9815
+ || taskEventCompletionInfo.caseId !== eventDetails.caseId
9816
+ || taskEventCompletionInfo.userId !== eventDetails.userId) {
9817
+ return true;
9818
+ }
9819
+ return false;
9820
+ }
9777
9821
  static ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i4.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
9778
9822
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) { if (rf & 1) {
9779
9823
  i0.ɵɵelement(0, "router-outlet");
@@ -9797,7 +9841,7 @@ class CaseEditComponent {
9797
9841
  }], submitted: [{
9798
9842
  type: Output
9799
9843
  }] }); })();
9800
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 34 }); })();
9844
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 35 }); })();
9801
9845
 
9802
9846
  function CaseEditConfirmComponent_div_3_Template(rf, ctx) { if (rf & 1) {
9803
9847
  i0.ɵɵelement(0, "div");
@@ -10211,6 +10255,7 @@ class LinkedCasesService {
10211
10255
  storedCaseNumber = '';
10212
10256
  cameFromFinalStep = false;
10213
10257
  hasNavigatedInJourney = false;
10258
+ cachedFieldValues;
10214
10259
  constructor(jurisdictionService, searchService) {
10215
10260
  this.jurisdictionService = jurisdictionService;
10216
10261
  this.searchService = searchService;
@@ -10605,7 +10650,8 @@ class CaseEditPageComponent {
10605
10650
  this.cancel();
10606
10651
  }
10607
10652
  isAtStart() {
10608
- return this.multipageComponentStateService.getJourneyCollection()[0]?.fieldState === this.multipageComponentStateService.getJourneyCollection()[0]?.journeyStartPageNumber;
10653
+ const pageNumberToUse = this.multipageComponentStateService.getJourneyCollection()[0]?.linkedCasesPage !== undefined ? this.multipageComponentStateService.getJourneyCollection()[0]?.linkedCasesPage : this.multipageComponentStateService.getJourneyCollection()[0]?.fieldState;
10654
+ return pageNumberToUse === this.multipageComponentStateService.getJourneyCollection()[0]?.journeyStartPageNumber;
10609
10655
  }
10610
10656
  isAtEnd() {
10611
10657
  return this.multipageComponentStateService.getJourneyCollection()[0]?.fieldState === this.multipageComponentStateService.getJourneyCollection()[0]?.journeyEndPageNumber;
@@ -11339,20 +11385,118 @@ class CallbackErrorsComponent {
11339
11385
  }] }); })();
11340
11386
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CallbackErrorsComponent, { className: "CallbackErrorsComponent", filePath: "lib/shared/components/error/callback-errors.component.ts", lineNumber: 10 }); })();
11341
11387
 
11388
+ function CaseEventCompletionComponent_app_case_event_completion_task_cancelled_0_Template(rf, ctx) { if (rf & 1) {
11389
+ const _r1 = i0.ɵɵgetCurrentView();
11390
+ i0.ɵɵelementStart(0, "app-case-event-completion-task-cancelled", 2);
11391
+ i0.ɵɵlistener("notifyEventCompletionCancelled", function CaseEventCompletionComponent_app_case_event_completion_task_cancelled_0_Template_app_case_event_completion_task_cancelled_notifyEventCompletionCancelled_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setEventCanBeCompleted($event)); });
11392
+ i0.ɵɵelementEnd();
11393
+ } if (rf & 2) {
11394
+ const ctx_r1 = i0.ɵɵnextContext();
11395
+ i0.ɵɵproperty("context", ctx_r1.context);
11396
+ } }
11397
+ function CaseEventCompletionComponent_app_case_event_completion_task_reassigned_1_Template(rf, ctx) { if (rf & 1) {
11398
+ const _r3 = i0.ɵɵgetCurrentView();
11399
+ i0.ɵɵelementStart(0, "app-case-event-completion-task-reassigned", 3);
11400
+ i0.ɵɵlistener("notifyEventCompletionReassigned", function CaseEventCompletionComponent_app_case_event_completion_task_reassigned_1_Template_app_case_event_completion_task_reassigned_notifyEventCompletionReassigned_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setEventCanBeCompleted($event)); });
11401
+ i0.ɵɵelementEnd();
11402
+ } if (rf & 2) {
11403
+ const ctx_r1 = i0.ɵɵnextContext();
11404
+ i0.ɵɵproperty("context", ctx_r1.context);
11405
+ } }
11406
+ const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
11407
+ class CaseEventCompletionComponent {
11408
+ service;
11409
+ router;
11410
+ route;
11411
+ sessionStorageService;
11412
+ workAllocationService;
11413
+ alertService;
11414
+ eventCompletionParams;
11415
+ eventCanBeCompleted = new EventEmitter();
11416
+ eventCompletionTaskStates = EventCompletionTaskStates;
11417
+ stateMachine;
11418
+ context;
11419
+ taskState;
11420
+ constructor(service, router, route, sessionStorageService, workAllocationService, alertService) {
11421
+ this.service = service;
11422
+ this.router = router;
11423
+ this.route = route;
11424
+ this.sessionStorageService = sessionStorageService;
11425
+ this.workAllocationService = workAllocationService;
11426
+ this.alertService = alertService;
11427
+ }
11428
+ ngOnChanges(changes) {
11429
+ if (changes.eventCompletionParams?.currentValue) {
11430
+ // Setup the context
11431
+ this.context = {
11432
+ task: this.eventCompletionParams.task,
11433
+ caseId: this.eventCompletionParams.caseId,
11434
+ eventId: this.eventCompletionParams.eventId,
11435
+ reassignedTask: null,
11436
+ router: this.router,
11437
+ route: this.route,
11438
+ sessionStorageService: this.sessionStorageService,
11439
+ workAllocationService: this.workAllocationService,
11440
+ alertService: this.alertService,
11441
+ canBeCompleted: false,
11442
+ component: this
11443
+ };
11444
+ // Initialise state machine
11445
+ this.stateMachine = this.service.initialiseStateMachine(this.context);
11446
+ // Create states
11447
+ this.service.createStates(this.stateMachine);
11448
+ // Add transitions for the states
11449
+ this.service.addTransitions();
11450
+ // Start state machine
11451
+ this.service.startStateMachine(this.stateMachine);
11452
+ }
11453
+ }
11454
+ setTaskState(taskState) {
11455
+ this.taskState = taskState;
11456
+ }
11457
+ setEventCanBeCompleted(completable) {
11458
+ // note: event not completed from here as will then skip task completion
11459
+ if (!completable) {
11460
+ // if event cannot be completed ensure that this is communicated
11461
+ // otherwise this will be handled via onchanges
11462
+ this.eventCanBeCompleted.emit(completable);
11463
+ }
11464
+ }
11465
+ static ɵfac = function CaseEventCompletionComponent_Factory(t) { return new (t || CaseEventCompletionComponent)(i0.ɵɵdirectiveInject(EventCompletionStateMachineService), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(AlertService)); };
11466
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionComponent, selectors: [["ccd-case-event-completion"]], inputs: { eventCompletionParams: "eventCompletionParams" }, outputs: { eventCanBeCompleted: "eventCanBeCompleted" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [[3, "context", "notifyEventCompletionCancelled", 4, "ngIf"], [3, "context", "notifyEventCompletionReassigned", 4, "ngIf"], [3, "notifyEventCompletionCancelled", "context"], [3, "notifyEventCompletionReassigned", "context"]], template: function CaseEventCompletionComponent_Template(rf, ctx) { if (rf & 1) {
11467
+ i0.ɵɵtemplate(0, CaseEventCompletionComponent_app_case_event_completion_task_cancelled_0_Template, 1, 1, "app-case-event-completion-task-cancelled", 0)(1, CaseEventCompletionComponent_app_case_event_completion_task_reassigned_1_Template, 1, 1, "app-case-event-completion-task-reassigned", 1);
11468
+ } if (rf & 2) {
11469
+ i0.ɵɵproperty("ngIf", ctx.taskState === ctx.eventCompletionTaskStates.TaskCancelled);
11470
+ i0.ɵɵadvance();
11471
+ i0.ɵɵproperty("ngIf", ctx.taskState === ctx.eventCompletionTaskStates.TaskReassigned);
11472
+ } }, encapsulation: 2 });
11473
+ }
11474
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionComponent, [{
11475
+ type: Component,
11476
+ args: [{ selector: 'ccd-case-event-completion', template: "<app-case-event-completion-task-cancelled\n *ngIf=\"taskState === eventCompletionTaskStates.TaskCancelled\"\n [context]=\"context\"\n (notifyEventCompletionCancelled)=\"setEventCanBeCompleted($event)\">\n</app-case-event-completion-task-cancelled>\n<app-case-event-completion-task-reassigned\n *ngIf=\"taskState === eventCompletionTaskStates.TaskReassigned\"\n [context]=\"context\"\n (notifyEventCompletionReassigned)=\"setEventCanBeCompleted($event)\">\n</app-case-event-completion-task-reassigned>" }]
11477
+ }], () => [{ type: EventCompletionStateMachineService }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: WorkAllocationService }, { type: AlertService }], { eventCompletionParams: [{
11478
+ type: Input
11479
+ }], eventCanBeCompleted: [{
11480
+ type: Output
11481
+ }] }); })();
11482
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionComponent, { className: "CaseEventCompletionComponent", filePath: "lib/shared/components/case-editor/case-event-completion/case-event-completion.component.ts", lineNumber: 20 }); })();
11483
+
11342
11484
  const _c0$Z = a0 => ["/", "cases", "case-details", a0, "tasks"];
11343
11485
  class CaseEventCompletionTaskCancelledComponent {
11344
- parentComponent;
11486
+ context;
11487
+ notifyEventCompletionCancelled = new EventEmitter();
11345
11488
  caseId;
11346
- constructor(parentComponent) {
11347
- this.parentComponent = parentComponent;
11348
- this.caseId = this.parentComponent.context.caseId;
11489
+ ngOnInit() {
11490
+ this.caseId = this.context.caseId;
11349
11491
  }
11350
11492
  onContinue() {
11351
- // Emit event can be completed event
11352
- this.parentComponent.eventCanBeCompleted.emit(true);
11493
+ // Removes task to complete so event completes without task
11494
+ this.context.sessionStorageService.removeItem('clientContext');
11495
+ // may be able to remove this call below since it is now unneccesary
11496
+ this.notifyEventCompletionCancelled.emit(true);
11353
11497
  }
11354
- static ɵfac = function CaseEventCompletionTaskCancelledComponent_Factory(t) { return new (t || CaseEventCompletionTaskCancelledComponent)(i0.ɵɵdirectiveInject(COMPONENT_PORTAL_INJECTION_TOKEN)); };
11355
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionTaskCancelledComponent, selectors: [["app-case-event-completion-task-cancelled"]], decls: 31, vars: 27, consts: [[1, "govuk-!-margin-9"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], ["href", "#"], [1, "govuk-form-group", "govuk-form-group--error"], [1, "govuk-heading-m"], [1, "form-group", "form-group-related"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-!-margin-right-2", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", 3, "routerLink"]], template: function CaseEventCompletionTaskCancelledComponent_Template(rf, ctx) { if (rf & 1) {
11498
+ static ɵfac = function CaseEventCompletionTaskCancelledComponent_Factory(t) { return new (t || CaseEventCompletionTaskCancelledComponent)(); };
11499
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionTaskCancelledComponent, selectors: [["app-case-event-completion-task-cancelled"]], inputs: { context: "context" }, outputs: { notifyEventCompletionCancelled: "notifyEventCompletionCancelled" }, decls: 31, vars: 27, consts: [[1, "govuk-!-margin-9"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], ["href", "#"], [1, "govuk-form-group", "govuk-form-group--error"], [1, "govuk-heading-m"], [1, "form-group", "form-group-related"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-!-margin-right-2", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", 3, "routerLink"]], template: function CaseEventCompletionTaskCancelledComponent_Template(rf, ctx) { if (rf & 1) {
11356
11500
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "h2", 2);
11357
11501
  i0.ɵɵtext(3);
11358
11502
  i0.ɵɵpipe(4, "rpxTranslate");
@@ -11410,11 +11554,12 @@ class CaseEventCompletionTaskCancelledComponent {
11410
11554
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionTaskCancelledComponent, [{
11411
11555
  type: Component,
11412
11556
  args: [{ selector: 'app-case-event-completion-task-cancelled', template: "<div class=\"govuk-!-margin-9\">\n <div class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\" data-module=\"error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{'There is a problem' | rpxTranslate}}\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li>\n <a href=\"#\">{{'Task cancelled/marked as done' | rpxTranslate}}</a>\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"govuk-form-group govuk-form-group--error\">\n <h2 class=\"govuk-heading-m\">{{'Task cancelled/marked as done' | rpxTranslate}}</h2>\n <p>{{'This task has been cancelled or marked as done.' | rpxTranslate}}</p>\n <p>{{'Click Continue to complete the event and save your progress.' | rpxTranslate}}</p>\n\n <p>{{'Alternatively, click Cancel to return to the tasks tab without saving your progress.' | rpxTranslate}}</p>\n\n <div class=\"form-group form-group-related\">\n <button class=\"govuk-button govuk-!-margin-right-2\" data-module=\"govuk-button\" (click)=\"onContinue()\">\n {{'Continue' | rpxTranslate}}\n </button>\n <a [routerLink]=\"['/', 'cases', 'case-details', caseId, 'tasks']\"\n class=\"govuk-button govuk-button--secondary\" data-module=\"govuk-button\">\n {{'Cancel' | rpxTranslate}}\n </a>\n </div>\n </div>\n</div>\n" }]
11413
- }], () => [{ type: CaseEventCompletionComponent, decorators: [{
11414
- type: Inject,
11415
- args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11416
- }] }], null); })();
11417
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskCancelledComponent, { className: "CaseEventCompletionTaskCancelledComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.ts", lineNumber: 8 }); })();
11557
+ }], null, { context: [{
11558
+ type: Input
11559
+ }], notifyEventCompletionCancelled: [{
11560
+ type: Output
11561
+ }] }); })();
11562
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskCancelledComponent, { className: "CaseEventCompletionTaskCancelledComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-cancelled/case-event-completion-task-cancelled.component.ts", lineNumber: 9 }); })();
11418
11563
 
11419
11564
  const _c0$Y = a0 => ["/", "cases", "case-details", a0, "tasks"];
11420
11565
  function CaseEventCompletionTaskReassignedComponent_div_0_Template(rf, ctx) { if (rf & 1) {
@@ -11474,32 +11619,26 @@ function CaseEventCompletionTaskReassignedComponent_div_0_Template(rf, ctx) { if
11474
11619
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(30, 24, "Cancel"), " ");
11475
11620
  } }
11476
11621
  class CaseEventCompletionTaskReassignedComponent {
11477
- parentComponent;
11478
- route;
11479
- workAllocationService;
11480
11622
  sessionStorageService;
11481
11623
  judicialworkerService;
11482
11624
  caseworkerService;
11483
- alertService;
11625
+ context;
11626
+ notifyEventCompletionReassigned = new EventEmitter();
11484
11627
  caseId;
11485
11628
  assignedUserId;
11486
11629
  assignedUserName;
11487
11630
  subscription;
11488
11631
  caseworkerSubscription;
11489
11632
  judicialworkerSubscription;
11490
- constructor(parentComponent, route, workAllocationService, sessionStorageService, judicialworkerService, caseworkerService, alertService) {
11491
- this.parentComponent = parentComponent;
11492
- this.route = route;
11493
- this.workAllocationService = workAllocationService;
11633
+ constructor(sessionStorageService, judicialworkerService, caseworkerService) {
11494
11634
  this.sessionStorageService = sessionStorageService;
11495
11635
  this.judicialworkerService = judicialworkerService;
11496
11636
  this.caseworkerService = caseworkerService;
11497
- this.alertService = alertService;
11498
11637
  }
11499
11638
  ngOnInit() {
11500
11639
  // Get case id and task from the parent component
11501
- this.caseId = this.parentComponent.context.caseId;
11502
- const task = this.parentComponent.context.reassignedTask;
11640
+ this.caseId = this.context.caseId;
11641
+ const task = this.context.reassignedTask;
11503
11642
  // Current user is a caseworker?
11504
11643
  this.caseworkerSubscription = this.caseworkerService.getCaseworkers(task.jurisdiction).subscribe(result => {
11505
11644
  if (result && result[0].service === task.jurisdiction && result[0].caseworkers) {
@@ -11544,17 +11683,17 @@ class CaseEventCompletionTaskReassignedComponent {
11544
11683
  // not complete_task not utilised here as related to event completion
11545
11684
  // service wanting task associated with event to not be completed not directly relevant
11546
11685
  if (task) {
11547
- this.sessionStorageService.setItem('assignNeeded', 'true');
11548
- // set event can be completed to true
11549
- this.parentComponent.eventCanBeCompleted.emit(true);
11686
+ // Set session to override reassignment settings so code flow does not return to this component
11687
+ this.sessionStorageService.setItem('assignNeeded', 'true - override');
11688
+ this.notifyEventCompletionReassigned.emit(true);
11550
11689
  }
11551
11690
  else {
11552
11691
  // Emit event cannot be completed event
11553
- this.parentComponent.eventCanBeCompleted.emit(false);
11692
+ this.notifyEventCompletionReassigned.emit(false);
11554
11693
  }
11555
11694
  }
11556
- static ɵfac = function CaseEventCompletionTaskReassignedComponent_Factory(t) { return new (t || CaseEventCompletionTaskReassignedComponent)(i0.ɵɵdirectiveInject(COMPONENT_PORTAL_INJECTION_TOKEN), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(JudicialworkerService), i0.ɵɵdirectiveInject(CaseworkerService), i0.ɵɵdirectiveInject(AlertService)); };
11557
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionTaskReassignedComponent, selectors: [["app-case-event-completion-task-reassigned"]], decls: 1, vars: 1, consts: [["class", "govuk-!-margin-9", 4, "ngIf"], [1, "govuk-!-margin-9"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], ["href", "#"], [1, "govuk-form-group", "govuk-form-group--error"], [1, "govuk-heading-m"], [1, "form-group", "form-group-related"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-!-margin-right-2", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", 3, "routerLink"]], template: function CaseEventCompletionTaskReassignedComponent_Template(rf, ctx) { if (rf & 1) {
11695
+ static ɵfac = function CaseEventCompletionTaskReassignedComponent_Factory(t) { return new (t || CaseEventCompletionTaskReassignedComponent)(i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(JudicialworkerService), i0.ɵɵdirectiveInject(CaseworkerService)); };
11696
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionTaskReassignedComponent, selectors: [["app-case-event-completion-task-reassigned"]], inputs: { context: "context" }, outputs: { notifyEventCompletionReassigned: "notifyEventCompletionReassigned" }, decls: 1, vars: 1, consts: [["class", "govuk-!-margin-9", 4, "ngIf"], [1, "govuk-!-margin-9"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], ["href", "#"], [1, "govuk-form-group", "govuk-form-group--error"], [1, "govuk-heading-m"], [1, "form-group", "form-group-related"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-!-margin-right-2", 3, "click"], ["data-module", "govuk-button", 1, "govuk-button", "govuk-button--secondary", 3, "routerLink"]], template: function CaseEventCompletionTaskReassignedComponent_Template(rf, ctx) { if (rf & 1) {
11558
11697
  i0.ɵɵtemplate(0, CaseEventCompletionTaskReassignedComponent_div_0_Template, 31, 28, "div", 0);
11559
11698
  } if (rf & 2) {
11560
11699
  i0.ɵɵproperty("ngIf", ctx.assignedUserName);
@@ -11563,92 +11702,12 @@ class CaseEventCompletionTaskReassignedComponent {
11563
11702
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionTaskReassignedComponent, [{
11564
11703
  type: Component,
11565
11704
  args: [{ selector: 'app-case-event-completion-task-reassigned', template: "<div class=\"govuk-!-margin-9\" *ngIf=\"assignedUserName\">\n <div class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\"\n data-module=\"error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{'There is a problem' | rpxTranslate}}\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li>\n <a href=\"#\">{{'Task reassigned' | rpxTranslate}}</a>\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"govuk-form-group govuk-form-group--error\">\n <h2 class=\"govuk-heading-m\">{{'Task reassigned' | rpxTranslate}}</h2>\n <p>{{'This task has been reassigned to' | rpxTranslate}} {{assignedUserName}}.</p>\n <p>{{'Click Continue to reassign the task to you and save your progress.' | rpxTranslate}}</p>\n <p>{{'Alternatively, click Cancel to return to the tasks tab without saving your progress.' | rpxTranslate}}</p>\n <div class=\"form-group form-group-related\">\n <button class=\"govuk-button govuk-!-margin-right-2\" data-module=\"govuk-button\" (click)=\"onContinue()\">\n {{'Continue' | rpxTranslate}}\n </button>\n <a [routerLink]=\"['/', 'cases', 'case-details', caseId, 'tasks']\"\n class=\"govuk-button govuk-button--secondary\" data-module=\"govuk-button\">\n {{'Cancel' | rpxTranslate}}\n </a>\n </div>\n </div>\n</div>\n" }]
11566
- }], () => [{ type: CaseEventCompletionComponent, decorators: [{
11567
- type: Inject,
11568
- args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11569
- }] }, { type: i1$1.ActivatedRoute }, { type: WorkAllocationService }, { type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }, { type: AlertService }], null); })();
11570
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber: 19 }); })();
11571
-
11572
- function CaseEventCompletionComponent_ng_template_0_Template(rf, ctx) { }
11573
- const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
11574
- class CaseEventCompletionComponent {
11575
- service;
11576
- router;
11577
- route;
11578
- sessionStorageService;
11579
- workAllocationService;
11580
- alertService;
11581
- eventCompletionParams;
11582
- eventCanBeCompleted = new EventEmitter();
11583
- stateMachine;
11584
- context;
11585
- selectedComponentPortal;
11586
- constructor(service, router, route, sessionStorageService, workAllocationService, alertService) {
11587
- this.service = service;
11588
- this.router = router;
11589
- this.route = route;
11590
- this.sessionStorageService = sessionStorageService;
11591
- this.workAllocationService = workAllocationService;
11592
- this.alertService = alertService;
11593
- }
11594
- ngOnChanges(changes) {
11595
- if (changes.eventCompletionParams && changes.eventCompletionParams.currentValue) {
11596
- // Setup the context
11597
- this.context = {
11598
- task: this.eventCompletionParams.task,
11599
- caseId: this.eventCompletionParams.caseId,
11600
- eventId: this.eventCompletionParams.eventId,
11601
- reassignedTask: null,
11602
- router: this.router,
11603
- route: this.route,
11604
- sessionStorageService: this.sessionStorageService,
11605
- workAllocationService: this.workAllocationService,
11606
- alertService: this.alertService,
11607
- canBeCompleted: false,
11608
- component: this
11609
- };
11610
- // Initialise state machine
11611
- this.stateMachine = this.service.initialiseStateMachine(this.context);
11612
- // Create states
11613
- this.service.createStates(this.stateMachine);
11614
- // Add transitions for the states
11615
- this.service.addTransitions();
11616
- // Start state machine
11617
- this.service.startStateMachine(this.stateMachine);
11618
- }
11619
- }
11620
- showPortal(portalType) {
11621
- const injector = Injector.create({
11622
- providers: [
11623
- { provide: COMPONENT_PORTAL_INJECTION_TOKEN, useValue: this }
11624
- ]
11625
- });
11626
- // tslint:disable-next-line:switch-default
11627
- switch (portalType) {
11628
- case EventCompletionPortalTypes.TaskCancelled:
11629
- this.selectedComponentPortal = new ComponentPortal(CaseEventCompletionTaskCancelledComponent, null, injector);
11630
- break;
11631
- case EventCompletionPortalTypes.TaskReassigned:
11632
- this.selectedComponentPortal = new ComponentPortal(CaseEventCompletionTaskReassignedComponent, null, injector);
11633
- break;
11634
- }
11635
- }
11636
- static ɵfac = function CaseEventCompletionComponent_Factory(t) { return new (t || CaseEventCompletionComponent)(i0.ɵɵdirectiveInject(EventCompletionStateMachineService), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(AlertService)); };
11637
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventCompletionComponent, selectors: [["ccd-case-event-completion"]], inputs: { eventCompletionParams: "eventCompletionParams" }, outputs: { eventCanBeCompleted: "eventCanBeCompleted" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "cdkPortalOutlet"]], template: function CaseEventCompletionComponent_Template(rf, ctx) { if (rf & 1) {
11638
- i0.ɵɵtemplate(0, CaseEventCompletionComponent_ng_template_0_Template, 0, 0, "ng-template", 0);
11639
- } if (rf & 2) {
11640
- i0.ɵɵproperty("cdkPortalOutlet", ctx.selectedComponentPortal);
11641
- } }, encapsulation: 2 });
11642
- }
11643
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionComponent, [{
11644
- type: Component,
11645
- args: [{ selector: 'ccd-case-event-completion', template: "<ng-template [cdkPortalOutlet]=\"selectedComponentPortal\"></ng-template>\n" }]
11646
- }], () => [{ type: EventCompletionStateMachineService }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: WorkAllocationService }, { type: AlertService }], { eventCompletionParams: [{
11705
+ }], () => [{ type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }], { context: [{
11647
11706
  type: Input
11648
- }], eventCanBeCompleted: [{
11707
+ }], notifyEventCompletionReassigned: [{
11649
11708
  type: Output
11650
11709
  }] }); })();
11651
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionComponent, { className: "CaseEventCompletionComponent", filePath: "lib/shared/components/case-editor/case-event-completion/case-event-completion.component.ts", lineNumber: 21 }); })();
11710
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber: 15 }); })();
11652
11711
 
11653
11712
  class AddressOption {
11654
11713
  description;
@@ -17881,6 +17940,9 @@ class UnLinkCasesComponent extends AbstractFieldWriteJourneyComponent {
17881
17940
  }
17882
17941
  getLinkedCases() {
17883
17942
  this.caseId = this.linkedCasesService.caseId;
17943
+ if (this.linkedCasesService.cachedFieldValues && this.linkedCasesService.linkedCases) {
17944
+ this.linkedCasesService.caseFieldValue = this.linkedCasesService.cachedFieldValues;
17945
+ }
17884
17946
  if (this.linkedCasesService.linkedCases.length > 0) {
17885
17947
  this.linkedCases = this.linkedCasesService.linkedCases;
17886
17948
  this.getAllLinkedCaseInformation();
@@ -18413,6 +18475,7 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteJourneyComponent
18413
18475
  }
18414
18476
  submitLinkedCases() {
18415
18477
  if (!this.linkedCasesService.isLinkedCasesEventTrigger) {
18478
+ this.linkedCasesService.cachedFieldValues = this.linkedCasesService.caseFieldValue;
18416
18479
  const unlinkedCaseRefereneIds = this.linkedCasesService.linkedCases.filter(item => item.unlink).map(item => item.caseReference);
18417
18480
  const caseFieldValue = this.linkedCasesService.caseFieldValue;
18418
18481
  this.linkedCasesService.caseFieldValue = caseFieldValue.filter(item => unlinkedCaseRefereneIds.indexOf(item.id) === -1);
@@ -29147,6 +29210,10 @@ i0.ɵɵsetComponentScope(QueryAttachmentsReadComponent, function () { return [i5
29147
29210
  i0.ɵɵsetComponentScope(QueryEventCompletionComponent, function () { return [
29148
29211
  // Case event completion
29149
29212
  CaseEventCompletionComponent]; }, []);
29213
+ i0.ɵɵsetComponentScope(
29214
+ // Case event completion
29215
+ CaseEventCompletionComponent, function () { return [i5.NgIf, CaseEventCompletionTaskCancelledComponent,
29216
+ CaseEventCompletionTaskReassignedComponent]; }, []);
29150
29217
 
29151
29218
  var CaseEditSubmitTitles;
29152
29219
  (function (CaseEditSubmitTitles) {
@@ -34241,12 +34308,18 @@ class EventStartGuard {
34241
34308
  const caseId = route.params['cid'];
34242
34309
  const eventId = route.params['eid'];
34243
34310
  const taskId = route.queryParams['tid'];
34311
+ let userId;
34312
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
34313
+ if (userInfoStr) {
34314
+ const userInfo = JSON.parse(userInfoStr);
34315
+ userId = userInfo.id ? userInfo.id : userInfo.uid;
34316
+ }
34244
34317
  const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
34245
34318
  if (caseInfoStr) {
34246
34319
  const caseInfo = JSON.parse(caseInfoStr);
34247
34320
  if (caseInfo && caseInfo.cid === caseId) {
34248
34321
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, caseInfo.caseType, caseInfo.jurisdiction)
34249
- .pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId)));
34322
+ .pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId, userId)));
34250
34323
  }
34251
34324
  else {
34252
34325
  this.abstractConfig.logMessage(`EventStartGuard: caseId ${caseInfo.cid} in caseInfo not matched with the route parameter caseId ${caseId}`);
@@ -34303,11 +34376,28 @@ class EventStartGuard {
34303
34376
  removeTaskFromSessionStorage() {
34304
34377
  this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
34305
34378
  }
34306
- checkForTasks(payload, caseId, eventId, taskId) {
34379
+ checkForTasks(payload, caseId, eventId, taskId, userId) {
34307
34380
  if (taskId && payload?.tasks?.length > 0) {
34308
34381
  const task = payload.tasks.find((t) => t.id == taskId);
34309
34382
  if (task) {
34310
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
34383
+ // Store task to session
34384
+ const taskEventCompletionInfo = {
34385
+ caseId: caseId,
34386
+ eventId: eventId,
34387
+ userId: userId,
34388
+ taskId: task.id,
34389
+ createdTimestamp: Date.now()
34390
+ };
34391
+ const storeClientContext = {
34392
+ client_context: {
34393
+ user_task: {
34394
+ task_data: task,
34395
+ complete_task: true
34396
+ }
34397
+ }
34398
+ };
34399
+ this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
34400
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
34311
34401
  }
34312
34402
  else {
34313
34403
  this.removeTaskFromSessionStorage();
@@ -34486,6 +34576,20 @@ class EventStartStateMachineService {
34486
34576
  }
34487
34577
  };
34488
34578
  context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
34579
+ let userInfo;
34580
+ const userInfoStr = context.sessionStorageService.getItem('userDetails');
34581
+ if (userInfoStr) {
34582
+ userInfo = JSON.parse(userInfoStr);
34583
+ }
34584
+ // Store task to session
34585
+ const taskEventCompletionInfo = {
34586
+ caseId: context.caseId,
34587
+ eventId: context.eventId,
34588
+ userId: userInfo.id ? userInfo.id : userInfo.uid,
34589
+ taskId: task.id,
34590
+ createdTimestamp: Date.now()
34591
+ };
34592
+ context.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
34489
34593
  // Allow user to perform the event
34490
34594
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
34491
34595
  }