@hmcts/ccd-case-ui-toolkit 7.0.6 → 7.0.7-task-completion-error-message

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.
@@ -4325,6 +4325,7 @@ class Constants {
4325
4325
  }
4326
4326
  Constants.MANDATORY = 'MANDATORY';
4327
4327
  Constants.REGEX_WHITESPACES = '^[^ ]+(?:\\s+[^ ]+)*$';
4328
+ Constants.TASK_COMPLETION_ERROR = 'The associated task for this event failed to complete automatically. Please complete the task manually in the Tasks tab on the case';
4328
4329
  Constants.ɵfac = function Constants_Factory(t) { return new (t || Constants)(); };
4329
4330
  Constants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: Constants, factory: Constants.ɵfac });
4330
4331
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Constants, [{
@@ -8429,7 +8430,7 @@ ValidPageListCaseFieldsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
8429
8430
  }], function () { return [{ type: FieldsUtils }]; }, null); })();
8430
8431
 
8431
8432
  class CaseEditComponent {
8432
- constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService) {
8433
+ constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService) {
8433
8434
  this.fb = fb;
8434
8435
  this.caseNotifier = caseNotifier;
8435
8436
  this.router = router;
@@ -8445,6 +8446,7 @@ class CaseEditComponent {
8445
8446
  this.loadingService = loadingService;
8446
8447
  this.validPageListCaseFieldsService = validPageListCaseFieldsService;
8447
8448
  this.workAllocationService = workAllocationService;
8449
+ this.alertService = alertService;
8448
8450
  this.cancelled = new EventEmitter();
8449
8451
  this.submitted = new EventEmitter();
8450
8452
  this.isEventCompletionChecksRequired = false;
@@ -8733,6 +8735,7 @@ class CaseEditComponent {
8733
8735
  const loadingSpinnerToken = this.loadingService.register();
8734
8736
  // keep the initial event response to finalise process after task completion
8735
8737
  let eventResponse;
8738
+ this.sessionStorageService.setItem('taskCompletionError', 'false');
8736
8739
  submit(caseEventData).pipe(switchMap((response) => {
8737
8740
  eventResponse = response;
8738
8741
  return this.postCompleteTaskIfRequired();
@@ -8741,6 +8744,10 @@ class CaseEditComponent {
8741
8744
  }))
8742
8745
  .subscribe(() => {
8743
8746
  this.finishEventCompletionLogic(eventResponse);
8747
+ /* NOTE: Uncomment this to test event confirmation page display of error
8748
+ Replicates lines 458-459
8749
+ this.alertService.setPreserveAlerts(true);
8750
+ this.alertService.error({phrase: 'The associated task for this event failed to complete automatically. Please complete the task manually in the Tasks tab on the case'}); */
8744
8751
  }, error => {
8745
8752
  if (!eventResponse) {
8746
8753
  // event submission error
@@ -8754,10 +8761,13 @@ class CaseEditComponent {
8754
8761
  this.isSubmitting = false;
8755
8762
  }
8756
8763
  else {
8764
+ this.sessionStorageService.setItem('taskCompletionError', 'true');
8757
8765
  // task assignment/completion error - handled within workallocation service
8758
8766
  // could set task to be deleted (or completed later)?
8759
- // note: think error messages only shown if user is caseworker - might reqauire changing
8760
8767
  this.finishEventCompletionLogic(eventResponse);
8768
+ // below allows error to be shown on navigation to confirmation page
8769
+ this.alertService.setPreserveAlerts(true);
8770
+ this.alertService.error({ phrase: Constants.TASK_COMPLETION_ERROR });
8761
8771
  }
8762
8772
  });
8763
8773
  }
@@ -8813,14 +8823,14 @@ class CaseEditComponent {
8813
8823
  }
8814
8824
  CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
8815
8825
  CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
8816
- CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(i1$2.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)); };
8826
+ CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(i1$2.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)); };
8817
8827
  CaseEditComponent.ɵ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) {
8818
8828
  i0.ɵɵelement(0, "router-outlet");
8819
8829
  } }, dependencies: [i1$2.RouterOutlet], styles: ["#fieldset-case-data[_ngcontent-%COMP%]{margin-bottom:30px}#fieldset-case-data[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{width:1%;white-space:nowrap;vertical-align:top}.compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:0}#confirmation-header[_ngcontent-%COMP%]{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body[_ngcontent-%COMP%]{width:630px;background-color:#fff}.valign-top[_ngcontent-%COMP%]{vertical-align:top}.summary-fields[_ngcontent-%COMP%]{margin-bottom:30px}.summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:0px}a.disabled[_ngcontent-%COMP%]{pointer-events:none;cursor:default}.case-field-label[_ngcontent-%COMP%]{width:45%}.case-field-content[_ngcontent-%COMP%]{width:50%}.case-field-change[_ngcontent-%COMP%]{width:5%}"] });
8820
8830
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
8821
8831
  type: Component,
8822
8832
  args: [{ selector: 'ccd-case-edit', providers: [GreyBarService], template: "<router-outlet></router-outlet>\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.case-field-change{width:5%}\n"] }]
8823
- }], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: WorkAllocationService }]; }, { eventTrigger: [{
8833
+ }], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: WorkAllocationService }, { type: AlertService }]; }, { eventTrigger: [{
8824
8834
  type: Input
8825
8835
  }], submit: [{
8826
8836
  type: Input
@@ -26042,7 +26052,7 @@ function CaseEventTriggerComponent_div_0_Template(rf, ctx) { if (rf & 1) {
26042
26052
  i0.ɵɵproperty("caseDetails", ctx_r0.caseDetails)("submit", ctx_r0.submit())("validate", ctx_r0.validate())("eventTrigger", ctx_r0.eventTrigger);
26043
26053
  } }
26044
26054
  class CaseEventTriggerComponent {
26045
- constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService) {
26055
+ constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService, sessionStorageService) {
26046
26056
  this.ngZone = ngZone;
26047
26057
  this.casesService = casesService;
26048
26058
  this.caseNotifier = caseNotifier;
@@ -26051,6 +26061,7 @@ class CaseEventTriggerComponent {
26051
26061
  this.route = route;
26052
26062
  this.caseReferencePipe = caseReferencePipe;
26053
26063
  this.activityPollingService = activityPollingService;
26064
+ this.sessionStorageService = sessionStorageService;
26054
26065
  this.BANNER = DisplayMode.BANNER;
26055
26066
  }
26056
26067
  ngOnInit() {
@@ -26112,21 +26123,30 @@ class CaseEventTriggerComponent {
26112
26123
  }
26113
26124
  submitted(event) {
26114
26125
  const eventStatus = event['status'];
26126
+ const taskCompletionFailed = this.sessionStorageService.getItem('taskCompletionError') === 'true';
26115
26127
  this.router
26116
26128
  .navigate([this.parentUrl])
26117
26129
  .then(() => {
26118
26130
  const caseReference = this.caseReferencePipe.transform(this.caseDetails.case_id.toString());
26119
26131
  const replacements = { CASEREFERENCE: caseReference, NAME: this.eventTrigger.name };
26120
- if (EventStatusService.isIncomplete(eventStatus)) {
26132
+ this.alertService.setPreserveAlerts(true);
26133
+ if (taskCompletionFailed) {
26134
+ // if task still present in session storage, we know that the task has not been correctly completed
26135
+ this.alertService.warning({
26136
+ phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + '. ' + Constants.TASK_COMPLETION_ERROR,
26137
+ replacements
26138
+ });
26139
+ this.sessionStorageService.removeItem('taskCompletionError');
26140
+ }
26141
+ else if (EventStatusService.isIncomplete(eventStatus)) {
26121
26142
  this.alertService.warning({
26122
- phrase: `Case #%CASEREFERENCE% has been updated with event: %NAME%
26123
- but the callback service cannot be completed`,
26143
+ phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE,
26124
26144
  replacements
26125
26145
  });
26126
26146
  }
26127
26147
  else {
26128
26148
  this.alertService.success({
26129
- phrase: 'Case #%CASEREFERENCE% has been updated with event: %NAME%',
26149
+ phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE,
26130
26150
  replacements,
26131
26151
  preserve: true
26132
26152
  });
@@ -26145,7 +26165,9 @@ class CaseEventTriggerComponent {
26145
26165
  return !!(this.eventTrigger && this.caseDetails);
26146
26166
  }
26147
26167
  }
26148
- CaseEventTriggerComponent.ɵfac = function CaseEventTriggerComponent_Factory(t) { return new (t || CaseEventTriggerComponent)(i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(i1$2.ActivatedRoute), i0.ɵɵdirectiveInject(CaseReferencePipe), i0.ɵɵdirectiveInject(ActivityPollingService)); };
26168
+ CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE = `Case #%CASEREFERENCE% has been updated with event: %NAME%`;
26169
+ CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE = ' but the callback service cannot be completed';
26170
+ CaseEventTriggerComponent.ɵfac = function CaseEventTriggerComponent_Factory(t) { return new (t || CaseEventTriggerComponent)(i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(i1$2.ActivatedRoute), i0.ɵɵdirectiveInject(CaseReferencePipe), i0.ɵɵdirectiveInject(ActivityPollingService), i0.ɵɵdirectiveInject(SessionStorageService)); };
26149
26171
  CaseEventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEventTriggerComponent, selectors: [["ccd-case-event-trigger"]], decls: 1, vars: 1, consts: [["class", "screen-990", 4, "ngIf"], [1, "screen-990"], [3, "caseId", "displayMode"], [3, "caseDetails", "submit", "validate", "eventTrigger", "cancelled", "submitted"]], template: function CaseEventTriggerComponent_Template(rf, ctx) { if (rf & 1) {
26150
26172
  i0.ɵɵtemplate(0, CaseEventTriggerComponent_div_0_Template, 3, 6, "div", 0);
26151
26173
  } if (rf & 2) {
@@ -26154,7 +26176,7 @@ CaseEventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: C
26154
26176
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventTriggerComponent, [{
26155
26177
  type: Component,
26156
26178
  args: [{ selector: 'ccd-case-event-trigger', template: "<div *ngIf=\"isDataLoaded()\" class=\"screen-990\">\n <ccd-activity [caseId]=\"caseDetails.case_id\" [displayMode]=\"BANNER\"></ccd-activity>\n <ccd-case-edit [caseDetails]=\"caseDetails\"\n [submit]=\"submit()\"\n [validate]=\"validate()\"\n [eventTrigger]=\"eventTrigger\"\n (cancelled)=\"cancel()\"\n (submitted)=\"submitted($event)\"></ccd-case-edit>\n</div>\n" }]
26157
- }], function () { return [{ type: i0.NgZone }, { type: CasesService }, { type: CaseNotifier }, { type: i1$2.Router }, { type: AlertService }, { type: i1$2.ActivatedRoute }, { type: CaseReferencePipe }, { type: ActivityPollingService }]; }, null); })();
26179
+ }], function () { return [{ type: i0.NgZone }, { type: CasesService }, { type: CaseNotifier }, { type: i1$2.Router }, { type: AlertService }, { type: i1$2.ActivatedRoute }, { type: CaseReferencePipe }, { type: ActivityPollingService }, { type: SessionStorageService }]; }, null); })();
26158
26180
 
26159
26181
  function CaseViewComponent_div_0_Template(rf, ctx) { if (rf & 1) {
26160
26182
  i0.ɵɵelementStart(0, "div");