@hmcts/ccd-case-ui-toolkit 6.19.5-secure-doc-case-creation.1 → 6.19.6-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.
Files changed (30) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +96 -47
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +10 -4
  6. package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +12 -4
  7. package/esm2015/lib/shared/components/case-editor/case-editor.module.js +7 -4
  8. package/esm2015/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.js +27 -0
  9. package/esm2015/lib/shared/components/create-case-filters/create-case-filters.component.js +3 -3
  10. package/esm2015/lib/shared/components/palette/document/write-document-field.component.js +20 -43
  11. package/esm2015/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.js +16 -1
  12. package/esm2015/lib/shared/components/workbasket-filters/workbasket-filters.component.js +12 -1
  13. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +88 -47
  14. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  15. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +4 -1
  16. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  17. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +4 -2
  18. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  19. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  20. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts +8 -0
  21. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts.map +1 -0
  22. package/lib/shared/components/create-case-filters/create-case-filters.component.d.ts +1 -1
  23. package/lib/shared/components/create-case-filters/create-case-filters.component.d.ts.map +1 -1
  24. package/lib/shared/components/palette/document/write-document-field.component.d.ts +4 -8
  25. package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
  26. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts +5 -3
  27. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts.map +1 -1
  28. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts +1 -1
  29. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts.map +1 -1
  30. package/package.json +1 -1
@@ -9892,8 +9892,38 @@
9892
9892
  }], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
9893
9893
  })();
9894
9894
 
9895
+ var ValidPageListCaseFieldsService = /** @class */ (function () {
9896
+ function ValidPageListCaseFieldsService() {
9897
+ }
9898
+ ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, data, notFromEventSubmit, fromPreviousPage) {
9899
+ if (fromPreviousPage === void 0) { fromPreviousPage = false; }
9900
+ var validPageListCaseFields = [];
9901
+ validPageList.forEach(function (page) {
9902
+ if (notFromEventSubmit || ShowCondition.getInstance(page.show_condition).match(data)) {
9903
+ page.case_fields.forEach(function (field) { return validPageListCaseFields.push(field); });
9904
+ }
9905
+ });
9906
+ if (!fromPreviousPage && validPageListCaseFields.length > 0) {
9907
+ Object.keys(data).forEach(function (key) {
9908
+ if (validPageListCaseFields.findIndex(function (element) { return element.id === key; }) < 0) {
9909
+ delete data[key];
9910
+ ;
9911
+ }
9912
+ });
9913
+ }
9914
+ };
9915
+ return ValidPageListCaseFieldsService;
9916
+ }());
9917
+ ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(); };
9918
+ ValidPageListCaseFieldsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: ValidPageListCaseFieldsService, factory: ValidPageListCaseFieldsService.ɵfac });
9919
+ (function () {
9920
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ValidPageListCaseFieldsService, [{
9921
+ type: i0.Injectable
9922
+ }], null, null);
9923
+ })();
9924
+
9895
9925
  var CaseEditComponent = /** @class */ (function () {
9896
- function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService) {
9926
+ function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService) {
9897
9927
  this.fb = fb;
9898
9928
  this.caseNotifier = caseNotifier;
9899
9929
  this.router = router;
@@ -9907,6 +9937,7 @@
9907
9937
  this.formValueService = formValueService;
9908
9938
  this.formErrorService = formErrorService;
9909
9939
  this.loadingService = loadingService;
9940
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
9910
9941
  this.cancelled = new i0.EventEmitter();
9911
9942
  this.submitted = new i0.EventEmitter();
9912
9943
  this.isEventCompletionChecksRequired = false;
@@ -9914,6 +9945,7 @@
9914
9945
  this.ignoreWarning = false;
9915
9946
  this.isLinkedCasesSubmission = false;
9916
9947
  this.callbackErrorsSubject = new rxjs.Subject();
9948
+ this.validPageList = [];
9917
9949
  }
9918
9950
  CaseEditComponent.prototype.ngOnInit = function () {
9919
9951
  var _this = this;
@@ -10078,6 +10110,8 @@
10078
10110
  this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
10079
10111
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
10080
10112
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
10113
+ // delete fields which are not part of the case event journey wizard pages case fields
10114
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, false);
10081
10115
  caseEventData.event_token = eventTrigger.event_token;
10082
10116
  caseEventData.ignore_warning = this.ignoreWarning;
10083
10117
  if (this.confirmation) {
@@ -10245,7 +10279,7 @@
10245
10279
  }());
10246
10280
  CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
10247
10281
  CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
10248
- CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
10282
+ CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
10249
10283
  CaseEditComponent.ɵcmp = i0__namespace.ɵɵ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__namespace.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) {
10250
10284
  if (rf & 1) {
10251
10285
  i0__namespace.ɵɵelement(0, "router-outlet");
@@ -10260,7 +10294,7 @@
10260
10294
  styleUrls: ['../case-edit.scss'],
10261
10295
  providers: [GreyBarService]
10262
10296
  }]
10263
- }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }]; }, { eventTrigger: [{
10297
+ }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, { eventTrigger: [{
10264
10298
  type: i0.Input
10265
10299
  }], submit: [{
10266
10300
  type: i0.Input
@@ -10956,7 +10990,7 @@
10956
10990
  }
10957
10991
  }
10958
10992
  var CaseEditPageComponent = /** @class */ (function () {
10959
- function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService) {
10993
+ function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
10960
10994
  this.caseEdit = caseEdit;
10961
10995
  this.route = route;
10962
10996
  this.formValueService = formValueService;
@@ -10967,6 +11001,7 @@
10967
11001
  this.caseFieldService = caseFieldService;
10968
11002
  this.caseEditDataService = caseEditDataService;
10969
11003
  this.loadingService = loadingService;
11004
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
10970
11005
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
10971
11006
  this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
10972
11007
  this.formValuesChanged = false;
@@ -11177,6 +11212,9 @@
11177
11212
  }
11178
11213
  }
11179
11214
  if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
11215
+ if (this.caseEdit.validPageList.findIndex(function (page) { return page.id === _this.currentPage.id; }) === -1) {
11216
+ this.caseEdit.validPageList.push(this.currentPage);
11217
+ }
11180
11218
  this.caseEdit.isSubmitting = true;
11181
11219
  this.caseEdit.error = null;
11182
11220
  var caseEventData = this.buildCaseEventData();
@@ -11445,6 +11483,8 @@
11445
11483
  this.formValueService.sanitiseDynamicLists(caseFields, formFields);
11446
11484
  // Get hold of the CaseEventData.
11447
11485
  var caseEventData = this.formValueService.sanitise(formFields);
11486
+ // delete fields which are not part of the case event journey wizard pages case fields
11487
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, true, fromPreviousPage);
11448
11488
  // Tidy it up before we return it.
11449
11489
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
11450
11490
  return caseEventData;
@@ -11487,7 +11527,7 @@
11487
11527
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
11488
11528
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
11489
11529
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
11490
- CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
11530
+ CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
11491
11531
  CaseEditPageComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CaseEditPageComponent, selectors: [["ccd-case-edit-page"]], decls: 12, vars: 11, consts: [[4, "ngIf"], [4, "ngIf", "ngIfThen", "ngIfElse"], ["titleBlock", ""], ["idBlock", ""], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], [3, "error"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [1, "width-50"], ["class", "form", 3, "formGroup", "submit", 4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], ["class", "govuk-heading-l", 4, "ngIf"], [1, "govuk-heading-l"], [1, "govuk-caption-l"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form", 3, "formGroup", "submit"], ["id", "fieldset-case-data"], [2, "display", "none"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "form-group", "form-group-related"], ["type", "button", 1, "button", "button-secondary", 3, "disabled", "click"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged"], [1, "grid-row"], [1, "column-two-thirds", "rightBorderSeparator"], ["id", "caseEditForm1", 3, "fields", "formGroup", "caseFields"], [1, "column-one-third"], ["id", "caseEditForm2", 3, "fields", "formGroup", "caseFields"], [3, "eventCompletionParams", "eventCanBeCompleted"]], template: function CaseEditPageComponent_Template(rf, ctx) {
11492
11532
  if (rf & 1) {
11493
11533
  i0__namespace.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
@@ -11530,7 +11570,7 @@
11530
11570
  templateUrl: 'case-edit-page.html',
11531
11571
  styleUrls: ['./case-edit-page.scss']
11532
11572
  }]
11533
- }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }]; }, null);
11573
+ }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null);
11534
11574
  })();
11535
11575
 
11536
11576
  var CallbackErrorsContext = /** @class */ (function () {
@@ -14635,19 +14675,18 @@
14635
14675
  var _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
14636
14676
  var WriteDocumentFieldComponent = /** @class */ (function (_super) {
14637
14677
  __extends(WriteDocumentFieldComponent, _super);
14638
- function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
14678
+ function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
14639
14679
  var _this = _super.call(this) || this;
14640
14680
  _this.appConfig = appConfig;
14641
14681
  _this.caseNotifier = caseNotifier;
14642
14682
  _this.documentManagement = documentManagement;
14643
14683
  _this.dialog = dialog;
14644
14684
  _this.fileUploadStateService = fileUploadStateService;
14645
- _this.jurisdictionService = jurisdictionService;
14646
14685
  _this.valid = true;
14647
14686
  return _this;
14648
14687
  }
14649
14688
  WriteDocumentFieldComponent.prototype.clickout = function (event) {
14650
- // Capturing the event of the associated ElementRef <input type="file" #fileInpu
14689
+ // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
14651
14690
  if (this.fileInput.nativeElement.contains(event.target)) {
14652
14691
  this.clickInsideTheDocument = true;
14653
14692
  }
@@ -14657,10 +14696,6 @@
14657
14696
  };
14658
14697
  WriteDocumentFieldComponent.prototype.ngOnInit = function () {
14659
14698
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
14660
- console.info('writeDocumentField.ngInit: secure mode = ' + this.secureModeOn);
14661
- if (this.secureModeOn) {
14662
- this.subscribeToCaseDetails();
14663
- }
14664
14699
  this.dialogConfig = initDialog();
14665
14700
  // EUI-3403. The field was not being registered when there was no value and the field
14666
14701
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -14673,6 +14708,9 @@
14673
14708
  else {
14674
14709
  this.createDocumentForm(document);
14675
14710
  }
14711
+ if (this.appConfig.getDocumentSecureMode()) {
14712
+ this.subscribeToCaseDetails();
14713
+ }
14676
14714
  };
14677
14715
  WriteDocumentFieldComponent.prototype.ngOnDestroy = function () {
14678
14716
  if (this.fileUploadSubscription) {
@@ -14681,11 +14719,8 @@
14681
14719
  if (this.dialogSubscription) {
14682
14720
  this.dialogSubscription.unsubscribe();
14683
14721
  }
14684
- if (this.caseNotifierSubscription) {
14685
- this.caseNotifierSubscription.unsubscribe();
14686
- }
14687
- if (this.jurisdictionSubs) {
14688
- this.jurisdictionSubs.unsubscribe();
14722
+ if (this.caseEventSubscription) {
14723
+ this.caseEventSubscription.unsubscribe();
14689
14724
  }
14690
14725
  };
14691
14726
  WriteDocumentFieldComponent.prototype.isUploadInProgress = function () {
@@ -14737,9 +14772,7 @@
14737
14772
  WriteDocumentFieldComponent.prototype.triggerReplace = function () {
14738
14773
  if (this.confirmReplaceResult === 'Replace') {
14739
14774
  this.openFileDialog();
14740
- return true;
14741
14775
  }
14742
- return false;
14743
14776
  };
14744
14777
  WriteDocumentFieldComponent.prototype.getUploadedFileName = function () {
14745
14778
  if (this.uploadedDocument) {
@@ -14774,30 +14807,11 @@
14774
14807
  _this.triggerReplace();
14775
14808
  });
14776
14809
  };
14777
- // Depending on the context, we can get the case type and jurisdiction from different sources
14778
- // If we are running an event, the caseNotifier will have the current case
14779
- // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
14780
- // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
14781
- // get the currently selected jurisdiction
14782
14810
  WriteDocumentFieldComponent.prototype.subscribeToCaseDetails = function () {
14783
14811
  var _this = this;
14784
- this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
14812
+ this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
14785
14813
  next: function (caseDetails) {
14786
- var _a, _b;
14787
- _this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
14788
- _this.jurisdictionId = (_b = (_a = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_type) === null || _a === void 0 ? void 0 : _a.jurisdiction) === null || _b === void 0 ? void 0 : _b.id;
14789
- console.info("caseNotifier.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14790
- }
14791
- });
14792
- this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
14793
- next: function (jurisdiction) {
14794
- if (jurisdiction) {
14795
- _this.jurisdictionId = jurisdiction.id;
14796
- if (jurisdiction.currentCaseType) {
14797
- _this.caseTypeId = jurisdiction.currentCaseType.id;
14798
- }
14799
- }
14800
- console.info("selectedJurisdiction.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14814
+ _this.caseDetails = caseDetails;
14801
14815
  }
14802
14816
  });
14803
14817
  };
@@ -14861,8 +14875,13 @@
14861
14875
  documentUpload.append('files', selectedFile, selectedFile.name);
14862
14876
  documentUpload.append('classification', 'PUBLIC');
14863
14877
  if (this.appConfig.getDocumentSecureMode()) {
14864
- var caseTypeId = this.caseTypeId ? this.caseTypeId : null;
14865
- var caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
14878
+ var caseTypeId = this.caseDetails &&
14879
+ this.caseDetails.case_type &&
14880
+ this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
14881
+ var caseTypeJurisdictionId = this.caseDetails &&
14882
+ this.caseDetails.case_type &&
14883
+ this.caseDetails.case_type.jurisdiction &&
14884
+ this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
14866
14885
  documentUpload.append('caseTypeId', caseTypeId);
14867
14886
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
14868
14887
  }
@@ -14910,7 +14929,7 @@
14910
14929
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
14911
14930
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
14912
14931
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
14913
- WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService), i0__namespace.ɵɵdirectiveInject(JurisdictionService)); };
14932
+ WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService)); };
14914
14933
  WriteDocumentFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) {
14915
14934
  if (rf & 1) {
14916
14935
  i0__namespace.ɵɵviewQuery(_c0$N, 1);
@@ -14988,7 +15007,7 @@
14988
15007
  selector: 'ccd-write-document-field',
14989
15008
  templateUrl: './write-document-field.html'
14990
15009
  }]
14991
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
15010
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
14992
15011
  type: i0.ViewChild,
14993
15012
  args: ['fileInput', { static: false }]
14994
15013
  }], clickout: [{
@@ -16425,12 +16444,24 @@
16425
16444
  }
16426
16445
  };
16427
16446
  WriteJudicialUserFieldComponent.prototype.setJurisdictionAndCaseType = function () {
16447
+ var _this = this;
16428
16448
  var caseInfoStr = this.sessionStorageService.getItem('caseInfo');
16429
16449
  if (caseInfoStr) {
16430
16450
  var caseInfo = JSON.parse(caseInfoStr);
16431
16451
  this.jurisdiction = caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.jurisdiction;
16432
16452
  this.caseType = caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.caseType;
16433
16453
  }
16454
+ else {
16455
+ // If there is no case info, attempt to get the current jurisdiction and case type via the JurisdictionService
16456
+ this.jurisdictionSubscription = this.jurisdictionService.selectedJurisdictionBS.subscribe(function (jurisdiction) {
16457
+ if (jurisdiction) {
16458
+ _this.jurisdiction = jurisdiction.id;
16459
+ if (jurisdiction.currentCaseType) {
16460
+ _this.caseType = jurisdiction.currentCaseType.id;
16461
+ }
16462
+ }
16463
+ });
16464
+ }
16434
16465
  };
16435
16466
  WriteJudicialUserFieldComponent.prototype.displayJudicialUser = function (judicialUser) {
16436
16467
  return judicialUser
@@ -16476,6 +16507,10 @@
16476
16507
  this.judicialUserControl.setValidators(i2$1.Validators.required);
16477
16508
  }
16478
16509
  };
16510
+ WriteJudicialUserFieldComponent.prototype.ngOnDestroy = function () {
16511
+ var _a;
16512
+ (_a = this.jurisdictionSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
16513
+ };
16479
16514
  return WriteJudicialUserFieldComponent;
16480
16515
  }(WriteComplexFieldComponent));
16481
16516
  WriteJudicialUserFieldComponent.ɵfac = function WriteJudicialUserFieldComponent_Factory(t) { return new (t || WriteJudicialUserFieldComponent)(i0__namespace.ɵɵdirectiveInject(JurisdictionService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(CaseFlagRefdataService), i0__namespace.ɵɵdirectiveInject(IsCompoundPipe), i0__namespace.ɵɵdirectiveInject(FormValidatorsService)); };
@@ -28609,7 +28644,8 @@
28609
28644
  JudicialworkerService,
28610
28645
  CaseworkerService,
28611
28646
  SessionStorageService,
28612
- EventCompletionStateMachineService
28647
+ EventCompletionStateMachineService,
28648
+ ValidPageListCaseFieldsService
28613
28649
  ], imports: [[
28614
28650
  i2.CommonModule,
28615
28651
  i1$1.RouterModule,
@@ -28725,7 +28761,8 @@
28725
28761
  JudicialworkerService,
28726
28762
  CaseworkerService,
28727
28763
  SessionStorageService,
28728
- EventCompletionStateMachineService
28764
+ EventCompletionStateMachineService,
28765
+ ValidPageListCaseFieldsService
28729
28766
  ]
28730
28767
  }]
28731
28768
  }], null, null);
@@ -29820,6 +29857,7 @@
29820
29857
  });
29821
29858
  };
29822
29859
  WorkbasketFiltersComponent.prototype.apply = function (init) {
29860
+ var _this = this;
29823
29861
  // Save filters as query parameters for current route
29824
29862
  var queryParams = {};
29825
29863
  if (this.selected.jurisdiction) {
@@ -29851,9 +29889,20 @@
29851
29889
  if (init) {
29852
29890
  this.windowService.setLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE, JSON.stringify(queryParams));
29853
29891
  if (Object.keys(this.formGroup.controls).length > 0) {
29892
+ // Find all "special case" JudicialUser FormControl keys and remove the corresponding values from the
29893
+ // FormGroup value because these values are not intended to be stored and subsequently passed as query string
29894
+ // parameters when calling searchCases API endpoint
29895
+ var judicialUserControlValuesToRemove = Object.keys(this.formGroup.controls).filter(function (key) { return key.endsWith('_judicialUserControl'); });
29896
+ judicialUserControlValuesToRemove.forEach(function (controlKey) { return delete _this.formGroup.value[controlKey]; });
29854
29897
  this.windowService.setLocalStorage(FORM_GROUP_VAL_LOC_STORAGE, JSON.stringify(this.formGroup.value));
29855
29898
  }
29856
29899
  }
29900
+ // Announce selected jurisdiction via JurisdictionService
29901
+ if (this.selected.jurisdiction) {
29902
+ // Set the selected case type as the current case type of the selected jurisdiction
29903
+ this.selected.jurisdiction.currentCaseType = this.selected.caseType;
29904
+ this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
29905
+ }
29857
29906
  // Apply filters
29858
29907
  this.onApply.emit({ selected: this.selected, queryParams: queryParams });
29859
29908
  this.setFocusToTop();