@hmcts/ccd-case-ui-toolkit 7.0.65 → 7.0.66-unavailable-date-show-fields

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 (46) 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-editor.module.mjs +1 -1
  3. package/esm2022/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.mjs +40 -28
  4. 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
  5. 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
  6. package/esm2022/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.mjs +1 -1
  7. package/esm2022/lib/shared/components/case-editor/domain/event-completion-task-states.model.mjs +6 -0
  8. package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +11 -5
  9. package/esm2022/lib/shared/components/case-editor/services/work-allocation.service.mjs +1 -1
  10. package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +28 -5
  11. package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +15 -1
  12. package/esm2022/lib/shared/components/palette/complex/read-complex-field-table.component.mjs +21 -5
  13. package/esm2022/lib/shared/components/palette/palette.module.mjs +5 -1
  14. package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
  15. package/esm2022/lib/shared/domain/work-allocation/task-response.model.mjs +1 -1
  16. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +263 -149
  17. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  18. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +5 -2
  19. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  20. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  21. package/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.d.ts +5 -3
  22. package/lib/shared/components/case-editor/case-event-completion/case-event-completion.component.d.ts.map +1 -1
  23. 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
  24. 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
  25. 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
  26. 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
  27. package/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.d.ts +1 -1
  28. package/lib/shared/components/case-editor/domain/event-completion-state-machine-context.model.d.ts.map +1 -1
  29. package/lib/shared/components/case-editor/domain/event-completion-task-states.model.d.ts +5 -0
  30. package/lib/shared/components/case-editor/domain/event-completion-task-states.model.d.ts.map +1 -0
  31. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
  32. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts +2 -2
  33. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts.map +1 -1
  34. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
  35. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
  36. package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
  37. package/lib/shared/components/palette/complex/read-complex-field-table.component.d.ts +7 -1
  38. package/lib/shared/components/palette/complex/read-complex-field-table.component.d.ts.map +1 -1
  39. package/lib/shared/domain/work-allocation/Task.d.ts +10 -1
  40. package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
  41. package/lib/shared/domain/work-allocation/task-response.model.d.ts +1 -1
  42. package/lib/shared/domain/work-allocation/task-response.model.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/esm2022/lib/shared/components/case-editor/domain/event-completion-portal-types.model.mjs +0 -6
  45. package/lib/shared/components/case-editor/domain/event-completion-portal-types.model.d.ts +0 -5
  46. 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';
@@ -52,6 +51,7 @@ import * as i15 from '@angular/material/legacy-input';
52
51
  import { MatLegacyInputModule } from '@angular/material/legacy-input';
53
52
  import * as i14 from '@hmcts/media-viewer';
54
53
  import { MediaViewerModule } from '@hmcts/media-viewer';
54
+ import { PortalModule } from '@angular/cdk/portal';
55
55
  import * as i2$3 from 'ngx-pagination';
56
56
  import { NgxPaginationModule, PaginatePipe } from 'ngx-pagination';
57
57
  import * as i10 from '@angular/material/legacy-tabs';
@@ -8710,11 +8710,11 @@ var TaskState;
8710
8710
  TaskState["PendingReConfiguration"] = "PENDING_RECONFIGURATION";
8711
8711
  })(TaskState || (TaskState = {}));
8712
8712
 
8713
- var EventCompletionPortalTypes;
8714
- (function (EventCompletionPortalTypes) {
8715
- EventCompletionPortalTypes[EventCompletionPortalTypes["TaskCancelled"] = 0] = "TaskCancelled";
8716
- EventCompletionPortalTypes[EventCompletionPortalTypes["TaskReassigned"] = 1] = "TaskReassigned";
8717
- })(EventCompletionPortalTypes || (EventCompletionPortalTypes = {}));
8713
+ var EventCompletionTaskStates;
8714
+ (function (EventCompletionTaskStates) {
8715
+ EventCompletionTaskStates[EventCompletionTaskStates["TaskCancelled"] = 0] = "TaskCancelled";
8716
+ EventCompletionTaskStates[EventCompletionTaskStates["TaskReassigned"] = 1] = "TaskReassigned";
8717
+ })(EventCompletionTaskStates || (EventCompletionTaskStates = {}));
8718
8718
 
8719
8719
  const EVENT_COMPLETION_STATE_MACHINE = 'EVENT COMPLETION STATE MACHINE';
8720
8720
  class EventCompletionStateMachineService {
@@ -8753,6 +8753,7 @@ class EventCompletionStateMachineService {
8753
8753
  this.addTransitionsForStateTaskUnassigned();
8754
8754
  }
8755
8755
  entryActionForStateCheckTasksCanBeCompleted(state, context) {
8756
+ const assignNeeded = context.sessionStorageService.getItem('assignNeeded');
8756
8757
  context.workAllocationService.getTask(context.task.id).subscribe(taskResponse => {
8757
8758
  if (taskResponse && taskResponse.task && taskResponse.task.task_state) {
8758
8759
  switch (taskResponse.task.task_state.toUpperCase()) {
@@ -8772,6 +8773,11 @@ class EventCompletionStateMachineService {
8772
8773
  // Task still assigned to current user, complete event and task
8773
8774
  state.trigger(EventCompletionStates.CompleteEventAndTask);
8774
8775
  }
8776
+ else if (assignNeeded === 'true - override') {
8777
+ // this will treat task as unassigned instead of reassigned to complete after user confirmation
8778
+ // assignNeeded will also be immediately overwritten to true
8779
+ state.trigger(EventCompletionStates.TaskUnassigned);
8780
+ }
8775
8781
  else {
8776
8782
  // Task has been reassigned to another user, display error message
8777
8783
  context.reassignedTask = taskResponse.task;
@@ -8793,7 +8799,7 @@ class EventCompletionStateMachineService {
8793
8799
  // Trigger final state to complete processing of state machine
8794
8800
  state.trigger(EventCompletionStates.Final);
8795
8801
  // Load case event completion task cancelled component
8796
- context.component.showPortal(EventCompletionPortalTypes.TaskCancelled);
8802
+ context.component.setTaskState(EventCompletionTaskStates.TaskCancelled);
8797
8803
  }
8798
8804
  entryActionForStateCompleteEventAndTask(state, context) {
8799
8805
  // Trigger final state to complete processing of state machine
@@ -8814,7 +8820,7 @@ class EventCompletionStateMachineService {
8814
8820
  // Trigger final state to complete processing of state machine
8815
8821
  state.trigger(EventCompletionStates.Final);
8816
8822
  // Load case event completion task reassigned component
8817
- context.component.showPortal(EventCompletionPortalTypes.TaskReassigned);
8823
+ context.component.setTaskState(EventCompletionTaskStates.TaskReassigned);
8818
8824
  }
8819
8825
  entryActionForStateTaskUnassigned(state, context) {
8820
8826
  // Trigger final state to complete processing of state machine
@@ -9379,15 +9385,22 @@ class CaseEditComponent {
9379
9385
  const clientContextStr = this.sessionStorageService.getItem('clientContext');
9380
9386
  const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9381
9387
  const taskInSessionStorage = userTask ? userTask.task_data : null;
9382
- let taskEventInSessionStorage;
9383
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
9384
- const taskEventStr = this.sessionStorageService.getItem('taskEvent');
9385
- if (taskEventStr) {
9386
- taskEventInSessionStorage = JSON.parse(taskEventStr);
9388
+ let taskEventCompletionInfo;
9389
+ let userInfo;
9390
+ const taskEventCompletionStr = this.sessionStorageService.getItem('taskEventCompletionInfo');
9391
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
9392
+ const assignNeeded = this.sessionStorageService.getItem('assignNeeded');
9393
+ if (taskEventCompletionStr) {
9394
+ taskEventCompletionInfo = JSON.parse(taskEventCompletionStr);
9395
+ }
9396
+ if (userInfoStr) {
9397
+ userInfo = JSON.parse(userInfoStr);
9387
9398
  }
9388
9399
  const eventId = this.getEventId(form);
9389
9400
  const caseId = this.getCaseId(caseDetails);
9390
- if (this.taskExistsForThisEventAndCase(taskInSessionStorage, taskEventInSessionStorage, eventId, caseId)) {
9401
+ const userId = userInfo.id ? userInfo.id : userInfo.uid;
9402
+ const eventDetails = { eventId, caseId, userId, assignNeeded };
9403
+ if (this.taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails)) {
9391
9404
  this.abstractConfig.logMessage(`task exist for this event for caseId and eventId as ${caseId} ${eventId}`);
9392
9405
  // Show event completion component to perform event completion checks
9393
9406
  this.eventCompletionParams = ({
@@ -9395,9 +9408,16 @@ class CaseEditComponent {
9395
9408
  eventId,
9396
9409
  task: taskInSessionStorage
9397
9410
  });
9398
- // add taskEvent to link current event with task id
9399
- const taskEvent = { eventId, taskId: taskInSessionStorage.id };
9400
- this.sessionStorageService.setItem('taskEvent', JSON.stringify(taskEvent));
9411
+ // add taskEventCompletionInfo again to ensure link current event with task id
9412
+ // note: previous usage was created here so this is to ensure correct functionality continues
9413
+ const taskEventCompletionInfo = {
9414
+ caseId,
9415
+ eventId,
9416
+ userId,
9417
+ taskId: taskInSessionStorage.id,
9418
+ createdTimestamp: Date.now()
9419
+ };
9420
+ this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
9401
9421
  this.isEventCompletionChecksRequired = true;
9402
9422
  }
9403
9423
  else {
@@ -9562,9 +9582,9 @@ class CaseEditComponent {
9562
9582
  return this.postCompleteTaskIfRequired();
9563
9583
  }), finalize(() => {
9564
9584
  this.loadingService.unregister(loadingSpinnerToken);
9565
- // on event completion ensure the previous event taskToComplete/taskEvent removed
9566
- this.sessionStorageService.removeItem('taskToComplete');
9567
- this.sessionStorageService.removeItem('taskEvent');
9585
+ // on event completion ensure the previous event clientContext/taskEventCompletionInfo removed
9586
+ this.sessionStorageService.removeItem('clientContext');
9587
+ this.sessionStorageService.removeItem('taskEventCompletionInfo');
9568
9588
  this.isSubmitting = false;
9569
9589
  }))
9570
9590
  .subscribe(() => {
@@ -9625,22 +9645,32 @@ class CaseEditComponent {
9625
9645
  return null;
9626
9646
  }
9627
9647
  }
9628
- // checks whether current taskToComplete relevant for the event
9629
- taskExistsForThisEventAndCase(taskInSessionStorage, taskEvent, eventId, caseId) {
9630
- if (!taskInSessionStorage || taskInSessionStorage.case_id !== caseId) {
9648
+ // checks whether current clientContext relevant for the event
9649
+ taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails) {
9650
+ if (!taskInSessionStorage || taskInSessionStorage.case_id !== eventDetails.caseId) {
9631
9651
  return false;
9632
9652
  }
9633
- if (!taskEvent) {
9653
+ if (!taskEventCompletionInfo) {
9634
9654
  // if no task event present then there is no task to complete from previous event present
9635
9655
  return true;
9636
9656
  }
9637
9657
  else {
9638
- if (taskEvent.taskId === taskInSessionStorage.id && taskEvent.eventId !== eventId) {
9658
+ if (taskEventCompletionInfo.taskId !== taskInSessionStorage.id) {
9659
+ return true;
9660
+ }
9661
+ else if ((taskEventCompletionInfo.taskId === taskInSessionStorage.id &&
9662
+ this.eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails))
9663
+ || this.eventMoreThanDayAgo(taskEventCompletionInfo.createdTimestamp)) {
9639
9664
  // if the session storage not related to event, ignore it and remove
9640
- this.sessionStorageService.removeItem('taskToComplete');
9641
- this.sessionStorageService.removeItem('taskEvent');
9665
+ this.sessionStorageService.removeItem('clientContext');
9666
+ this.sessionStorageService.removeItem('taskEventCompletionInfo');
9642
9667
  return false;
9643
9668
  }
9669
+ if (eventDetails.assignNeeded === 'false' && eventDetails.userId !== taskInSessionStorage.assignee) {
9670
+ // if the user does not match task assignee, assign is now needed
9671
+ // data cannot be deleted and ignored as it matches understanding
9672
+ this.sessionStorageService.setItem('assignNeeded', 'true');
9673
+ }
9644
9674
  return true;
9645
9675
  }
9646
9676
  }
@@ -9661,6 +9691,20 @@ class CaseEditComponent {
9661
9691
  hasCallbackFailed(response) {
9662
9692
  return response['callback_response_status'] !== 'CALLBACK_COMPLETED';
9663
9693
  }
9694
+ eventMoreThanDayAgo(timestamp) {
9695
+ if ((new Date().getTime() - timestamp) > (24 * 60 * 60 * 1000)) {
9696
+ return true;
9697
+ }
9698
+ return false;
9699
+ }
9700
+ eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails) {
9701
+ if (taskEventCompletionInfo.eventId !== eventDetails.eventId
9702
+ || taskEventCompletionInfo.caseId !== eventDetails.caseId
9703
+ || taskEventCompletionInfo.userId !== eventDetails.userId) {
9704
+ return true;
9705
+ }
9706
+ return false;
9707
+ }
9664
9708
  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)); };
9665
9709
  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) {
9666
9710
  i0.ɵɵelement(0, "router-outlet");
@@ -9684,7 +9728,7 @@ class CaseEditComponent {
9684
9728
  }], submitted: [{
9685
9729
  type: Output
9686
9730
  }] }); })();
9687
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 34 }); })();
9731
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 35 }); })();
9688
9732
 
9689
9733
  function CaseEditConfirmComponent_div_3_Template(rf, ctx) { if (rf & 1) {
9690
9734
  i0.ɵɵelement(0, "div");
@@ -11003,20 +11047,118 @@ class CallbackErrorsComponent {
11003
11047
  }] }); })();
11004
11048
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CallbackErrorsComponent, { className: "CallbackErrorsComponent", filePath: "lib/shared/components/error/callback-errors.component.ts", lineNumber: 10 }); })();
11005
11049
 
11050
+ function CaseEventCompletionComponent_app_case_event_completion_task_cancelled_0_Template(rf, ctx) { if (rf & 1) {
11051
+ const _r1 = i0.ɵɵgetCurrentView();
11052
+ i0.ɵɵelementStart(0, "app-case-event-completion-task-cancelled", 2);
11053
+ 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)); });
11054
+ i0.ɵɵelementEnd();
11055
+ } if (rf & 2) {
11056
+ const ctx_r1 = i0.ɵɵnextContext();
11057
+ i0.ɵɵproperty("context", ctx_r1.context);
11058
+ } }
11059
+ function CaseEventCompletionComponent_app_case_event_completion_task_reassigned_1_Template(rf, ctx) { if (rf & 1) {
11060
+ const _r3 = i0.ɵɵgetCurrentView();
11061
+ i0.ɵɵelementStart(0, "app-case-event-completion-task-reassigned", 3);
11062
+ 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)); });
11063
+ i0.ɵɵelementEnd();
11064
+ } if (rf & 2) {
11065
+ const ctx_r1 = i0.ɵɵnextContext();
11066
+ i0.ɵɵproperty("context", ctx_r1.context);
11067
+ } }
11068
+ const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
11069
+ class CaseEventCompletionComponent {
11070
+ service;
11071
+ router;
11072
+ route;
11073
+ sessionStorageService;
11074
+ workAllocationService;
11075
+ alertService;
11076
+ eventCompletionParams;
11077
+ eventCanBeCompleted = new EventEmitter();
11078
+ eventCompletionTaskStates = EventCompletionTaskStates;
11079
+ stateMachine;
11080
+ context;
11081
+ taskState;
11082
+ constructor(service, router, route, sessionStorageService, workAllocationService, alertService) {
11083
+ this.service = service;
11084
+ this.router = router;
11085
+ this.route = route;
11086
+ this.sessionStorageService = sessionStorageService;
11087
+ this.workAllocationService = workAllocationService;
11088
+ this.alertService = alertService;
11089
+ }
11090
+ ngOnChanges(changes) {
11091
+ if (changes.eventCompletionParams?.currentValue) {
11092
+ // Setup the context
11093
+ this.context = {
11094
+ task: this.eventCompletionParams.task,
11095
+ caseId: this.eventCompletionParams.caseId,
11096
+ eventId: this.eventCompletionParams.eventId,
11097
+ reassignedTask: null,
11098
+ router: this.router,
11099
+ route: this.route,
11100
+ sessionStorageService: this.sessionStorageService,
11101
+ workAllocationService: this.workAllocationService,
11102
+ alertService: this.alertService,
11103
+ canBeCompleted: false,
11104
+ component: this
11105
+ };
11106
+ // Initialise state machine
11107
+ this.stateMachine = this.service.initialiseStateMachine(this.context);
11108
+ // Create states
11109
+ this.service.createStates(this.stateMachine);
11110
+ // Add transitions for the states
11111
+ this.service.addTransitions();
11112
+ // Start state machine
11113
+ this.service.startStateMachine(this.stateMachine);
11114
+ }
11115
+ }
11116
+ setTaskState(taskState) {
11117
+ this.taskState = taskState;
11118
+ }
11119
+ setEventCanBeCompleted(completable) {
11120
+ // note: event not completed from here as will then skip task completion
11121
+ if (!completable) {
11122
+ // if event cannot be completed ensure that this is communicated
11123
+ // otherwise this will be handled via onchanges
11124
+ this.eventCanBeCompleted.emit(completable);
11125
+ }
11126
+ }
11127
+ 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)); };
11128
+ 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) {
11129
+ 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);
11130
+ } if (rf & 2) {
11131
+ i0.ɵɵproperty("ngIf", ctx.taskState === ctx.eventCompletionTaskStates.TaskCancelled);
11132
+ i0.ɵɵadvance();
11133
+ i0.ɵɵproperty("ngIf", ctx.taskState === ctx.eventCompletionTaskStates.TaskReassigned);
11134
+ } }, encapsulation: 2 });
11135
+ }
11136
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionComponent, [{
11137
+ type: Component,
11138
+ 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>" }]
11139
+ }], () => [{ type: EventCompletionStateMachineService }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: WorkAllocationService }, { type: AlertService }], { eventCompletionParams: [{
11140
+ type: Input
11141
+ }], eventCanBeCompleted: [{
11142
+ type: Output
11143
+ }] }); })();
11144
+ (() => { (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 }); })();
11145
+
11006
11146
  const _c0$X = a0 => ["/", "cases", "case-details", a0, "tasks"];
11007
11147
  class CaseEventCompletionTaskCancelledComponent {
11008
- parentComponent;
11148
+ context;
11149
+ notifyEventCompletionCancelled = new EventEmitter();
11009
11150
  caseId;
11010
- constructor(parentComponent) {
11011
- this.parentComponent = parentComponent;
11012
- this.caseId = this.parentComponent.context.caseId;
11151
+ ngOnInit() {
11152
+ this.caseId = this.context.caseId;
11013
11153
  }
11014
11154
  onContinue() {
11015
- // Emit event can be completed event
11016
- this.parentComponent.eventCanBeCompleted.emit(true);
11155
+ // Removes task to complete so event completes without task
11156
+ this.context.sessionStorageService.removeItem('clientContext');
11157
+ // may be able to remove this call below since it is now unneccesary
11158
+ this.notifyEventCompletionCancelled.emit(true);
11017
11159
  }
11018
- static ɵfac = function CaseEventCompletionTaskCancelledComponent_Factory(t) { return new (t || CaseEventCompletionTaskCancelledComponent)(i0.ɵɵdirectiveInject(COMPONENT_PORTAL_INJECTION_TOKEN)); };
11019
- 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) {
11160
+ static ɵfac = function CaseEventCompletionTaskCancelledComponent_Factory(t) { return new (t || CaseEventCompletionTaskCancelledComponent)(); };
11161
+ 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) {
11020
11162
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "h2", 2);
11021
11163
  i0.ɵɵtext(3);
11022
11164
  i0.ɵɵpipe(4, "rpxTranslate");
@@ -11074,11 +11216,12 @@ class CaseEventCompletionTaskCancelledComponent {
11074
11216
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionTaskCancelledComponent, [{
11075
11217
  type: Component,
11076
11218
  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" }]
11077
- }], () => [{ type: CaseEventCompletionComponent, decorators: [{
11078
- type: Inject,
11079
- args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11080
- }] }], null); })();
11081
- (() => { (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 }); })();
11219
+ }], null, { context: [{
11220
+ type: Input
11221
+ }], notifyEventCompletionCancelled: [{
11222
+ type: Output
11223
+ }] }); })();
11224
+ (() => { (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 }); })();
11082
11225
 
11083
11226
  const _c0$W = a0 => ["/", "cases", "case-details", a0, "tasks"];
11084
11227
  function CaseEventCompletionTaskReassignedComponent_div_0_Template(rf, ctx) { if (rf & 1) {
@@ -11138,32 +11281,26 @@ function CaseEventCompletionTaskReassignedComponent_div_0_Template(rf, ctx) { if
11138
11281
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(30, 24, "Cancel"), " ");
11139
11282
  } }
11140
11283
  class CaseEventCompletionTaskReassignedComponent {
11141
- parentComponent;
11142
- route;
11143
- workAllocationService;
11144
11284
  sessionStorageService;
11145
11285
  judicialworkerService;
11146
11286
  caseworkerService;
11147
- alertService;
11287
+ context;
11288
+ notifyEventCompletionReassigned = new EventEmitter();
11148
11289
  caseId;
11149
11290
  assignedUserId;
11150
11291
  assignedUserName;
11151
11292
  subscription;
11152
11293
  caseworkerSubscription;
11153
11294
  judicialworkerSubscription;
11154
- constructor(parentComponent, route, workAllocationService, sessionStorageService, judicialworkerService, caseworkerService, alertService) {
11155
- this.parentComponent = parentComponent;
11156
- this.route = route;
11157
- this.workAllocationService = workAllocationService;
11295
+ constructor(sessionStorageService, judicialworkerService, caseworkerService) {
11158
11296
  this.sessionStorageService = sessionStorageService;
11159
11297
  this.judicialworkerService = judicialworkerService;
11160
11298
  this.caseworkerService = caseworkerService;
11161
- this.alertService = alertService;
11162
11299
  }
11163
11300
  ngOnInit() {
11164
11301
  // Get case id and task from the parent component
11165
- this.caseId = this.parentComponent.context.caseId;
11166
- const task = this.parentComponent.context.reassignedTask;
11302
+ this.caseId = this.context.caseId;
11303
+ const task = this.context.reassignedTask;
11167
11304
  // Current user is a caseworker?
11168
11305
  this.caseworkerSubscription = this.caseworkerService.getCaseworkers(task.jurisdiction).subscribe(result => {
11169
11306
  if (result && result[0].service === task.jurisdiction && result[0].caseworkers) {
@@ -11208,17 +11345,17 @@ class CaseEventCompletionTaskReassignedComponent {
11208
11345
  // not complete_task not utilised here as related to event completion
11209
11346
  // service wanting task associated with event to not be completed not directly relevant
11210
11347
  if (task) {
11211
- this.sessionStorageService.setItem('assignNeeded', 'true');
11212
- // set event can be completed to true
11213
- this.parentComponent.eventCanBeCompleted.emit(true);
11348
+ // Set session to override reassignment settings so code flow does not return to this component
11349
+ this.sessionStorageService.setItem('assignNeeded', 'true - override');
11350
+ this.notifyEventCompletionReassigned.emit(true);
11214
11351
  }
11215
11352
  else {
11216
11353
  // Emit event cannot be completed event
11217
- this.parentComponent.eventCanBeCompleted.emit(false);
11354
+ this.notifyEventCompletionReassigned.emit(false);
11218
11355
  }
11219
11356
  }
11220
- 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)); };
11221
- 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) {
11357
+ static ɵfac = function CaseEventCompletionTaskReassignedComponent_Factory(t) { return new (t || CaseEventCompletionTaskReassignedComponent)(i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(JudicialworkerService), i0.ɵɵdirectiveInject(CaseworkerService)); };
11358
+ 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) {
11222
11359
  i0.ɵɵtemplate(0, CaseEventCompletionTaskReassignedComponent_div_0_Template, 31, 28, "div", 0);
11223
11360
  } if (rf & 2) {
11224
11361
  i0.ɵɵproperty("ngIf", ctx.assignedUserName);
@@ -11227,92 +11364,12 @@ class CaseEventCompletionTaskReassignedComponent {
11227
11364
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionTaskReassignedComponent, [{
11228
11365
  type: Component,
11229
11366
  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" }]
11230
- }], () => [{ type: CaseEventCompletionComponent, decorators: [{
11231
- type: Inject,
11232
- args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11233
- }] }, { type: i1$1.ActivatedRoute }, { type: WorkAllocationService }, { type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }, { type: AlertService }], null); })();
11234
- (() => { (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 }); })();
11235
-
11236
- function CaseEventCompletionComponent_ng_template_0_Template(rf, ctx) { }
11237
- const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
11238
- class CaseEventCompletionComponent {
11239
- service;
11240
- router;
11241
- route;
11242
- sessionStorageService;
11243
- workAllocationService;
11244
- alertService;
11245
- eventCompletionParams;
11246
- eventCanBeCompleted = new EventEmitter();
11247
- stateMachine;
11248
- context;
11249
- selectedComponentPortal;
11250
- constructor(service, router, route, sessionStorageService, workAllocationService, alertService) {
11251
- this.service = service;
11252
- this.router = router;
11253
- this.route = route;
11254
- this.sessionStorageService = sessionStorageService;
11255
- this.workAllocationService = workAllocationService;
11256
- this.alertService = alertService;
11257
- }
11258
- ngOnChanges(changes) {
11259
- if (changes.eventCompletionParams && changes.eventCompletionParams.currentValue) {
11260
- // Setup the context
11261
- this.context = {
11262
- task: this.eventCompletionParams.task,
11263
- caseId: this.eventCompletionParams.caseId,
11264
- eventId: this.eventCompletionParams.eventId,
11265
- reassignedTask: null,
11266
- router: this.router,
11267
- route: this.route,
11268
- sessionStorageService: this.sessionStorageService,
11269
- workAllocationService: this.workAllocationService,
11270
- alertService: this.alertService,
11271
- canBeCompleted: false,
11272
- component: this
11273
- };
11274
- // Initialise state machine
11275
- this.stateMachine = this.service.initialiseStateMachine(this.context);
11276
- // Create states
11277
- this.service.createStates(this.stateMachine);
11278
- // Add transitions for the states
11279
- this.service.addTransitions();
11280
- // Start state machine
11281
- this.service.startStateMachine(this.stateMachine);
11282
- }
11283
- }
11284
- showPortal(portalType) {
11285
- const injector = Injector.create({
11286
- providers: [
11287
- { provide: COMPONENT_PORTAL_INJECTION_TOKEN, useValue: this }
11288
- ]
11289
- });
11290
- // tslint:disable-next-line:switch-default
11291
- switch (portalType) {
11292
- case EventCompletionPortalTypes.TaskCancelled:
11293
- this.selectedComponentPortal = new ComponentPortal(CaseEventCompletionTaskCancelledComponent, null, injector);
11294
- break;
11295
- case EventCompletionPortalTypes.TaskReassigned:
11296
- this.selectedComponentPortal = new ComponentPortal(CaseEventCompletionTaskReassignedComponent, null, injector);
11297
- break;
11298
- }
11299
- }
11300
- 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)); };
11301
- 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) {
11302
- i0.ɵɵtemplate(0, CaseEventCompletionComponent_ng_template_0_Template, 0, 0, "ng-template", 0);
11303
- } if (rf & 2) {
11304
- i0.ɵɵproperty("cdkPortalOutlet", ctx.selectedComponentPortal);
11305
- } }, encapsulation: 2 });
11306
- }
11307
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventCompletionComponent, [{
11308
- type: Component,
11309
- args: [{ selector: 'ccd-case-event-completion', template: "<ng-template [cdkPortalOutlet]=\"selectedComponentPortal\"></ng-template>\n" }]
11310
- }], () => [{ type: EventCompletionStateMachineService }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: SessionStorageService }, { type: WorkAllocationService }, { type: AlertService }], { eventCompletionParams: [{
11367
+ }], () => [{ type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }], { context: [{
11311
11368
  type: Input
11312
- }], eventCanBeCompleted: [{
11369
+ }], notifyEventCompletionReassigned: [{
11313
11370
  type: Output
11314
11371
  }] }); })();
11315
- (() => { (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 }); })();
11372
+ (() => { (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 }); })();
11316
11373
 
11317
11374
  class AddressOption {
11318
11375
  description;
@@ -25785,7 +25842,7 @@ class ReadComplexFieldRawComponent extends AbstractFieldReadComponent {
25785
25842
  }] }); })();
25786
25843
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadComplexFieldRawComponent, { className: "ReadComplexFieldRawComponent", filePath: "lib/shared/components/palette/complex/read-complex-field-raw.component.ts", lineNumber: 16 }); })();
25787
25844
 
25788
- const _c0$j = (a0, a1, a2) => [a0, false, undefined, true, a1, undefined, a2];
25845
+ const _c0$j = (a0, a1, a2, a3) => [a0, false, undefined, true, a1, a2, a3];
25789
25846
  function ReadComplexFieldTableComponent_ng_container_9_ng_container_1_Template(rf, ctx) { if (rf & 1) {
25790
25847
  i0.ɵɵelementContainerStart(0);
25791
25848
  i0.ɵɵelementStart(1, "tr", 7)(2, "td", 8)(3, "span", 3);
@@ -25830,9 +25887,25 @@ function ReadComplexFieldTableComponent_ng_container_9_Template(rf, ctx) { if (r
25830
25887
  i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(2, 2, field_r1))("ngIfElse", SimpleRow_r3);
25831
25888
  } }
25832
25889
  class ReadComplexFieldTableComponent extends AbstractFieldReadComponent {
25890
+ // parent_ can be replaced with any ***_ - underscore is only important character
25891
+ // value can also be replaced with anything
25892
+ static DUMMY_STRING_PRE = 'parent_';
25893
+ static DUMMY_STRING_POST = 'value';
25833
25894
  caseFields = [];
25895
+ path;
25896
+ ngOnInit() {
25897
+ this.setDummyPathForChildArrays();
25898
+ }
25899
+ /* In order to get child arrays (within casefield) to display their logic
25900
+ we need to add a path. This path needs to include the idPrefix as that
25901
+ is the part of the path that is used to display the elements.
25902
+ The joining strings will allow us to use the existing show condition to
25903
+ match against this path. */
25904
+ setDummyPathForChildArrays() {
25905
+ this.path = ReadComplexFieldTableComponent.DUMMY_STRING_PRE + this.idPrefix + ReadComplexFieldTableComponent.DUMMY_STRING_POST;
25906
+ }
25834
25907
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadComplexFieldTableComponent_BaseFactory; return function ReadComplexFieldTableComponent_Factory(t) { return (ɵReadComplexFieldTableComponent_BaseFactory || (ɵReadComplexFieldTableComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadComplexFieldTableComponent)))(t || ReadComplexFieldTableComponent); }; })();
25835
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadComplexFieldTableComponent, selectors: [["ccd-read-complex-field-table"]], inputs: { caseFields: "caseFields" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 16, consts: [["SimpleRow", ""], [1, "complex-panel"], [1, "complex-panel-title"], [1, "text-16"], ["aria-describedby", "complex field table", 1, "complex-panel-table"], [4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"], [1, "complex-panel-compound-field", 3, "hidden"], ["colspan", "2"], [3, "topLevelFormGroup", "caseField", "context"], [1, "complex-panel-simple-field", 3, "hidden"], ["id", "complex-panel-simple-field-label"]], template: function ReadComplexFieldTableComponent_Template(rf, ctx) { if (rf & 1) {
25908
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadComplexFieldTableComponent, selectors: [["ccd-read-complex-field-table"]], inputs: { caseFields: "caseFields" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 17, consts: [["SimpleRow", ""], [1, "complex-panel"], [1, "complex-panel-title"], [1, "text-16"], ["aria-describedby", "complex field table", 1, "complex-panel-table"], [4, "ngFor", "ngForOf"], [4, "ngIf", "ngIfElse"], [1, "complex-panel-compound-field", 3, "hidden"], ["colspan", "2"], [3, "topLevelFormGroup", "caseField", "context"], [1, "complex-panel-simple-field", 3, "hidden"], ["id", "complex-panel-simple-field-label"]], template: function ReadComplexFieldTableComponent_Template(rf, ctx) { if (rf & 1) {
25836
25909
  i0.ɵɵelementStart(0, "div", 1)(1, "dl", 2)(2, "dt")(3, "span", 3);
25837
25910
  i0.ɵɵtext(4);
25838
25911
  i0.ɵɵpipe(5, "rpxTranslate");
@@ -25847,12 +25920,12 @@ class ReadComplexFieldTableComponent extends AbstractFieldReadComponent {
25847
25920
  i0.ɵɵadvance(4);
25848
25921
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5, 2, ctx.caseField.label));
25849
25922
  i0.ɵɵadvance(5);
25850
- i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBindV(10, 4, i0.ɵɵpureFunction3(12, _c0$j, ctx.caseField, ctx.topLevelFormGroup, ctx.idPrefix)));
25923
+ i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBindV(10, 4, i0.ɵɵpureFunction4(12, _c0$j, ctx.caseField, ctx.topLevelFormGroup, ctx.path, ctx.idPrefix)));
25851
25924
  } }, styles: [".complex-panel[_ngcontent-%COMP%]{margin:13px 0;border:1px solid #bfc1c3}.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{font-size:19px;line-height:1.3157894737}}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%]{vertical-align:top}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > th[_ngcontent-%COMP%], .complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > td[_ngcontent-%COMP%]{border-bottom:none}.complex-panel[_ngcontent-%COMP%] .complex-panel-simple-field[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-left:5px;width:295px}.complex-panel[_ngcontent-%COMP%] .complex-panel-compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px}"] });
25852
25925
  }
25853
25926
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadComplexFieldTableComponent, [{
25854
25927
  type: Component,
25855
- args: [{ selector: 'ccd-read-complex-field-table', template: "<div class=\"complex-panel\">\n <dl class=\"complex-panel-title\"><dt><span class=\"text-16\">{{caseField.label | rpxTranslate}}</span></dt><dd></dd></dl>\n <table class=\"complex-panel-table\" aria-describedby=\"complex field table\">\n <tbody>\n <ng-container *ngFor=\"let field of caseField | ccdReadFieldsFilter:false :undefined :true :topLevelFormGroup: undefined :idPrefix\">\n <ng-container *ngIf=\"(field | ccdIsCompound); else SimpleRow\">\n <tr class=\"complex-panel-compound-field\" [hidden]=\"field.hidden\">\n <td colspan=\"2\">\n <span class=\"text-16\">\n <ccd-field-read [topLevelFormGroup]=\"topLevelFormGroup\"\n [caseField]=\"field\" [context]=\"context\"></ccd-field-read>\n </span>\n </td>\n </tr>\n </ng-container>\n <ng-template #SimpleRow>\n <tr class=\"complex-panel-simple-field\" [hidden]=\"field.hidden\">\n <th id=\"complex-panel-simple-field-label\"><span class=\"text-16\">{{field.label | rpxTranslate}}</span></th>\n <td>\n <span class=\"text-16\">\n <ccd-field-read [topLevelFormGroup]=\"topLevelFormGroup\"\n [caseField]=\"field\" [context]=\"context\"></ccd-field-read>\n </span>\n </td>\n </tr>\n </ng-template>\n </ng-container>\n </tbody>\n </table>\n</div>\n", styles: [".complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}\n"] }]
25928
+ args: [{ selector: 'ccd-read-complex-field-table', template: "<div class=\"complex-panel\">\n <dl class=\"complex-panel-title\"><dt><span class=\"text-16\">{{caseField.label | rpxTranslate}}</span></dt><dd></dd></dl>\n <table class=\"complex-panel-table\" aria-describedby=\"complex field table\">\n <tbody>\n <ng-container *ngFor=\"let field of caseField | ccdReadFieldsFilter:false :undefined :true :topLevelFormGroup :path :idPrefix\">\n <ng-container *ngIf=\"(field | ccdIsCompound); else SimpleRow\">\n <tr class=\"complex-panel-compound-field\" [hidden]=\"field.hidden\">\n <td colspan=\"2\">\n <span class=\"text-16\">\n <ccd-field-read [topLevelFormGroup]=\"topLevelFormGroup\"\n [caseField]=\"field\" [context]=\"context\"></ccd-field-read>\n </span>\n </td>\n </tr>\n </ng-container>\n <ng-template #SimpleRow>\n <tr class=\"complex-panel-simple-field\" [hidden]=\"field.hidden\">\n <th id=\"complex-panel-simple-field-label\"><span class=\"text-16\">{{field.label | rpxTranslate}}</span></th>\n <td>\n <span class=\"text-16\">\n <ccd-field-read [topLevelFormGroup]=\"topLevelFormGroup\"\n [caseField]=\"field\" [context]=\"context\"></ccd-field-read>\n </span>\n </td>\n </tr>\n </ng-template>\n </ng-container>\n </tbody>\n </table>\n</div>\n", styles: [".complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}\n"] }]
25856
25929
  }], null, { caseFields: [{
25857
25930
  type: Input
25858
25931
  }] }); })();
@@ -28540,6 +28613,10 @@ i0.ɵɵsetComponentScope(QueryAttachmentsReadComponent, function () { return [i5
28540
28613
  i0.ɵɵsetComponentScope(QueryEventCompletionComponent, function () { return [
28541
28614
  // Case event completion
28542
28615
  CaseEventCompletionComponent]; }, []);
28616
+ i0.ɵɵsetComponentScope(
28617
+ // Case event completion
28618
+ CaseEventCompletionComponent, function () { return [i5.NgIf, CaseEventCompletionTaskCancelledComponent,
28619
+ CaseEventCompletionTaskReassignedComponent]; }, []);
28543
28620
 
28544
28621
  var CaseEditSubmitTitles;
28545
28622
  (function (CaseEditSubmitTitles) {
@@ -33614,12 +33691,18 @@ class EventStartGuard {
33614
33691
  const caseId = route.params['cid'];
33615
33692
  const eventId = route.params['eid'];
33616
33693
  const taskId = route.queryParams['tid'];
33694
+ let userId;
33695
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
33696
+ if (userInfoStr) {
33697
+ const userInfo = JSON.parse(userInfoStr);
33698
+ userId = userInfo.id ? userInfo.id : userInfo.uid;
33699
+ }
33617
33700
  const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
33618
33701
  if (caseInfoStr) {
33619
33702
  const caseInfo = JSON.parse(caseInfoStr);
33620
33703
  if (caseInfo && caseInfo.cid === caseId) {
33621
33704
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, caseInfo.caseType, caseInfo.jurisdiction)
33622
- .pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId)));
33705
+ .pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId, userId)));
33623
33706
  }
33624
33707
  else {
33625
33708
  this.abstractConfig.logMessage(`EventStartGuard: caseId ${caseInfo.cid} in caseInfo not matched with the route parameter caseId ${caseId}`);
@@ -33676,11 +33759,28 @@ class EventStartGuard {
33676
33759
  removeTaskFromSessionStorage() {
33677
33760
  this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
33678
33761
  }
33679
- checkForTasks(payload, caseId, eventId, taskId) {
33762
+ checkForTasks(payload, caseId, eventId, taskId, userId) {
33680
33763
  if (taskId && payload?.tasks?.length > 0) {
33681
33764
  const task = payload.tasks.find((t) => t.id == taskId);
33682
33765
  if (task) {
33683
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
33766
+ // Store task to session
33767
+ const taskEventCompletionInfo = {
33768
+ caseId: caseId,
33769
+ eventId: eventId,
33770
+ userId: userId,
33771
+ taskId: task.id,
33772
+ createdTimestamp: Date.now()
33773
+ };
33774
+ const storeClientContext = {
33775
+ client_context: {
33776
+ user_task: {
33777
+ task_data: task,
33778
+ complete_task: true
33779
+ }
33780
+ }
33781
+ };
33782
+ this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
33783
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
33684
33784
  }
33685
33785
  else {
33686
33786
  this.removeTaskFromSessionStorage();
@@ -33859,6 +33959,20 @@ class EventStartStateMachineService {
33859
33959
  }
33860
33960
  };
33861
33961
  context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
33962
+ let userInfo;
33963
+ const userInfoStr = context.sessionStorageService.getItem('userDetails');
33964
+ if (userInfoStr) {
33965
+ userInfo = JSON.parse(userInfoStr);
33966
+ }
33967
+ // Store task to session
33968
+ const taskEventCompletionInfo = {
33969
+ caseId: context.caseId,
33970
+ eventId: context.eventId,
33971
+ userId: userInfo.id ? userInfo.id : userInfo.uid,
33972
+ taskId: task.id,
33973
+ createdTimestamp: Date.now()
33974
+ };
33975
+ context.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
33862
33976
  // Allow user to perform the event
33863
33977
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
33864
33978
  }