@hmcts/ccd-case-ui-toolkit 7.0.44 → 7.0.46-exui-2086-rc1

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.
@@ -9326,17 +9326,27 @@ class CaseEditComponent {
9326
9326
  // We have to run the event completion checks if task in session storage
9327
9327
  // and if the task is in session storage, then is it associated to the case
9328
9328
  let taskInSessionStorage;
9329
+ let taskEventInSessionStorage;
9329
9330
  const taskStr = this.sessionStorageService.getItem('taskToComplete');
9331
+ const taskEventStr = this.sessionStorageService.getItem('taskEvent');
9330
9332
  if (taskStr) {
9331
9333
  taskInSessionStorage = JSON.parse(taskStr);
9332
9334
  }
9333
- if (taskInSessionStorage && taskInSessionStorage.case_id === this.getCaseId(caseDetails)) {
9335
+ if (taskEventStr) {
9336
+ taskEventInSessionStorage = JSON.parse(taskEventStr);
9337
+ }
9338
+ const eventId = this.getEventId(form);
9339
+ const caseId = this.getCaseId(caseDetails);
9340
+ if (this.taskExistsForThisEventAndCase(taskInSessionStorage, taskEventInSessionStorage, eventId, caseId)) {
9334
9341
  // Show event completion component to perform event completion checks
9335
9342
  this.eventCompletionParams = ({
9336
- caseId: this.getCaseId(caseDetails),
9337
- eventId: this.getEventId(form),
9343
+ caseId,
9344
+ eventId,
9338
9345
  task: taskInSessionStorage
9339
9346
  });
9347
+ // add taskEvent to link current event with task id
9348
+ const taskEvent = { eventId, taskId: taskInSessionStorage.id };
9349
+ this.sessionStorageService.setItem('taskEvent', JSON.stringify(taskEvent));
9340
9350
  this.isEventCompletionChecksRequired = true;
9341
9351
  }
9342
9352
  else {
@@ -9501,6 +9511,10 @@ class CaseEditComponent {
9501
9511
  return this.postCompleteTaskIfRequired();
9502
9512
  }), finalize(() => {
9503
9513
  this.loadingService.unregister(loadingSpinnerToken);
9514
+ // on event completion ensure the previous event taskToComplete/taskEvent removed
9515
+ this.sessionStorageService.removeItem('taskToComplete');
9516
+ this.sessionStorageService.removeItem('taskEvent');
9517
+ this.isSubmitting = false;
9504
9518
  }))
9505
9519
  .subscribe(() => {
9506
9520
  this.finishEventCompletionLogic(eventResponse);
@@ -9514,7 +9528,6 @@ class CaseEditComponent {
9514
9528
  this.formErrorService
9515
9529
  .mapFieldErrors(this.error.details.field_errors, form.controls['data'], 'validation');
9516
9530
  }
9517
- this.isSubmitting = false;
9518
9531
  }
9519
9532
  else {
9520
9533
  this.sessionStorageService.setItem('taskCompletionError', 'true');
@@ -9559,6 +9572,25 @@ class CaseEditComponent {
9559
9572
  return null;
9560
9573
  }
9561
9574
  }
9575
+ // checks whether current taskToComplete relevant for the event
9576
+ taskExistsForThisEventAndCase(taskInSessionStorage, taskEvent, eventId, caseId) {
9577
+ if (!taskInSessionStorage || taskInSessionStorage.case_id !== caseId) {
9578
+ return false;
9579
+ }
9580
+ if (!taskEvent) {
9581
+ // if no task event present then there is no task to complete from previous event present
9582
+ return true;
9583
+ }
9584
+ else {
9585
+ if (taskEvent.taskId === taskInSessionStorage.id && taskEvent.eventId !== eventId) {
9586
+ // if the session storage not related to event, ignore it and remove
9587
+ this.sessionStorageService.removeItem('taskToComplete');
9588
+ this.sessionStorageService.removeItem('taskEvent');
9589
+ return false;
9590
+ }
9591
+ return true;
9592
+ }
9593
+ }
9562
9594
  onEventCanBeCompleted({ eventTrigger, eventCanBeCompleted, caseDetails, form, submit }) {
9563
9595
  if (eventCanBeCompleted) {
9564
9596
  // Submit
@@ -10425,7 +10457,6 @@ class CaseEditPageComponent {
10425
10457
  }
10426
10458
  submit() {
10427
10459
  this.caseEditDataService.clearFormValidationErrors();
10428
- console.log('Page submit event fired!');
10429
10460
  if (this.currentPageIsNotValid()) {
10430
10461
  // The generateErrorMessage method filters out the hidden fields.
10431
10462
  // The error message for LinkedCases journey will never get displayed because the
@@ -10451,6 +10482,7 @@ class CaseEditPageComponent {
10451
10482
  this.validateSub = this.caseEdit.validate(caseEventData, this.currentPage.id)
10452
10483
  .pipe(finalize(() => {
10453
10484
  this.loadingService.unregister(loadingSpinnerToken);
10485
+ this.caseEdit.isSubmitting = false;
10454
10486
  }))
10455
10487
  .subscribe((jsonData) => {
10456
10488
  /* istanbul ignore else */
@@ -11875,7 +11907,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) { if
11875
11907
  } if (rf & 2) {
11876
11908
  const ctx_r1 = i0.ɵɵnextContext(2);
11877
11909
  i0.ɵɵadvance();
11878
- i0.ɵɵproperty("url", ctx_r1.currentDocument.document_binary_url)("downloadFileName", ctx_r1.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r1.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh")("enableICP", ctx_r1.isIcpEnabled());
11910
+ i0.ɵɵproperty("url", ctx_r1.currentDocument.document_binary_url)("downloadFileName", ctx_r1.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r1.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh")("caseId", ctx_r1.caseId)("enableICP", ctx_r1.isIcpEnabled());
11879
11911
  } }
11880
11912
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11881
11913
  const _r3 = i0.ɵɵgetCurrentView();
@@ -11887,7 +11919,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11887
11919
  i0.ɵɵelementEnd()();
11888
11920
  i0.ɵɵelement(6, "div", 16);
11889
11921
  i0.ɵɵelementStart(7, "div", 17);
11890
- i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 8, "ng-container", 0);
11922
+ i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 9, "ng-container", 0);
11891
11923
  i0.ɵɵelementEnd()()();
11892
11924
  } if (rf & 2) {
11893
11925
  const ctx_r1 = i0.ɵɵnextContext();
@@ -11916,6 +11948,7 @@ class CaseFileViewFieldComponent {
11916
11948
  caseField;
11917
11949
  icp_jurisdictions = [];
11918
11950
  icpEnabled = false;
11951
+ caseId;
11919
11952
  constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11920
11953
  this.elementRef = elementRef;
11921
11954
  this.route = route;
@@ -11927,8 +11960,8 @@ class CaseFileViewFieldComponent {
11927
11960
  this.abstractConfig = abstractConfig;
11928
11961
  }
11929
11962
  ngOnInit() {
11930
- const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
11931
- this.categoriesAndDocuments$ = this.caseFileViewService.getCategoriesAndDocuments(cid);
11963
+ this.caseId = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
11964
+ this.categoriesAndDocuments$ = this.caseFileViewService.getCategoriesAndDocuments(this.caseId);
11932
11965
  this.categoriesAndDocumentsSubscription = this.categoriesAndDocuments$.subscribe({
11933
11966
  next: data => {
11934
11967
  this.caseVersion = data.case_version;
@@ -12005,7 +12038,7 @@ class CaseFileViewFieldComponent {
12005
12038
  return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
12006
12039
  }
12007
12040
  static ɵfac = function CaseFileViewFieldComponent_Factory(t) { return new (t || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
12008
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
12041
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "caseId", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
12009
12042
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0)(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1)(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
12010
12043
  } if (rf & 2) {
12011
12044
  i0.ɵɵproperty("ngIf", ctx.errorMessages == null ? null : ctx.errorMessages.length);
@@ -12017,7 +12050,7 @@ class CaseFileViewFieldComponent {
12017
12050
  }
12018
12051
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
12019
12052
  type: Component,
12020
- args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [enableICP]=\"isIcpEnabled()\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
12053
+ args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [caseId]=\"caseId\"\n [enableICP]=\"isIcpEnabled()\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
12021
12054
  }], () => [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }], null); })();
12022
12055
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 17 }); })();
12023
12056