@hmcts/ccd-case-ui-toolkit 7.0.12 → 7.0.13-address-validation-fix
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.
- package/esm2020/lib/shared/commons/address-validation-constants.mjs +13 -0
- package/esm2020/lib/shared/commons/constants.mjs +2 -1
- package/esm2020/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +12 -6
- package/esm2020/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.mjs +15 -6
- package/esm2020/lib/shared/components/case-viewer/case-event-trigger/case-event-trigger.component.mjs +22 -9
- package/esm2020/lib/shared/components/palette/address/write-address-field.component.mjs +57 -20
- package/esm2020/lib/shared/components/palette/case-flag/write-case-flag-field.component.mjs +30 -26
- package/esm2020/lib/shared/services/addresses/addresses.service.mjs +9 -1
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +151 -61
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +144 -59
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/commons/address-validation-constants.d.ts +7 -0
- package/lib/shared/commons/address-validation-constants.d.ts.map +1 -0
- package/lib/shared/commons/constants.d.ts +1 -0
- package/lib/shared/commons/constants.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +3 -2
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +3 -2
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/case-event-trigger/case-event-trigger.component.d.ts +5 -2
- package/lib/shared/components/case-viewer/case-event-trigger/case-event-trigger.component.d.ts.map +1 -1
- package/lib/shared/components/palette/address/write-address-field.component.d.ts +5 -0
- package/lib/shared/components/palette/address/write-address-field.component.d.ts.map +1 -1
- package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts.map +1 -1
- package/lib/shared/services/addresses/addresses.service.d.ts +3 -0
- package/lib/shared/services/addresses/addresses.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import * as i1$1 from '@angular/router';
|
|
|
8
8
|
import { RouterModule, NavigationStart, NavigationEnd } from '@angular/router';
|
|
9
9
|
import * as i3 from '@angular/forms';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
|
-
import { throwError, Subject, EMPTY, Observable,
|
|
11
|
+
import { throwError, Subject, EMPTY, Observable, BehaviorSubject, of, timer, fromEvent, forkJoin, Subscription, combineLatest } from 'rxjs';
|
|
12
12
|
import * as i1$2 from '@angular/common/http';
|
|
13
13
|
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
14
14
|
import { catchError, map, publish, refCount, switchMap, debounceTime, delay, distinctUntilChanged, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
|
|
@@ -4534,6 +4534,7 @@ class Constants {
|
|
|
4534
4534
|
}
|
|
4535
4535
|
Constants.MANDATORY = 'MANDATORY';
|
|
4536
4536
|
Constants.REGEX_WHITESPACES = '^[^ ]+(?:\\s+[^ ]+)*$';
|
|
4537
|
+
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';
|
|
4537
4538
|
Constants.ɵfac = function Constants_Factory(t) { return new (t || Constants)(); };
|
|
4538
4539
|
Constants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: Constants, factory: Constants.ɵfac });
|
|
4539
4540
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Constants, [{
|
|
@@ -6252,6 +6253,7 @@ class AddressesService {
|
|
|
6252
6253
|
constructor(http, appConfig) {
|
|
6253
6254
|
this.http = http;
|
|
6254
6255
|
this.appConfig = appConfig;
|
|
6256
|
+
this.mandatoryError = new BehaviorSubject(false);
|
|
6255
6257
|
}
|
|
6256
6258
|
getAddressesForPostcode(postcode) {
|
|
6257
6259
|
return this.http
|
|
@@ -6260,6 +6262,12 @@ class AddressesService {
|
|
|
6260
6262
|
.pipe(map(res => res.results))
|
|
6261
6263
|
.pipe(map(output => output.map(addresses => this.format(new AddressParser().parse(addresses[AddressType.DPA])))));
|
|
6262
6264
|
}
|
|
6265
|
+
getMandatoryError() {
|
|
6266
|
+
return this.mandatoryError.asObservable();
|
|
6267
|
+
}
|
|
6268
|
+
setMandatoryError(value) {
|
|
6269
|
+
this.mandatoryError.next(value);
|
|
6270
|
+
}
|
|
6263
6271
|
format(addressModel) {
|
|
6264
6272
|
return this.formatAddressLines(this.shiftAddressLinesUp(addressModel));
|
|
6265
6273
|
}
|
|
@@ -8656,7 +8664,7 @@ ValidPageListCaseFieldsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
|
|
|
8656
8664
|
}], function () { return [{ type: FieldsUtils }]; }, null); })();
|
|
8657
8665
|
|
|
8658
8666
|
class CaseEditComponent {
|
|
8659
|
-
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService) {
|
|
8667
|
+
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService) {
|
|
8660
8668
|
this.fb = fb;
|
|
8661
8669
|
this.caseNotifier = caseNotifier;
|
|
8662
8670
|
this.router = router;
|
|
@@ -8672,6 +8680,7 @@ class CaseEditComponent {
|
|
|
8672
8680
|
this.loadingService = loadingService;
|
|
8673
8681
|
this.validPageListCaseFieldsService = validPageListCaseFieldsService;
|
|
8674
8682
|
this.workAllocationService = workAllocationService;
|
|
8683
|
+
this.alertService = alertService;
|
|
8675
8684
|
this.cancelled = new EventEmitter();
|
|
8676
8685
|
this.submitted = new EventEmitter();
|
|
8677
8686
|
this.isEventCompletionChecksRequired = false;
|
|
@@ -8960,6 +8969,7 @@ class CaseEditComponent {
|
|
|
8960
8969
|
const loadingSpinnerToken = this.loadingService.register();
|
|
8961
8970
|
// keep the initial event response to finalise process after task completion
|
|
8962
8971
|
let eventResponse;
|
|
8972
|
+
this.sessionStorageService.setItem('taskCompletionError', 'false');
|
|
8963
8973
|
submit(caseEventData).pipe(switchMap((response) => {
|
|
8964
8974
|
eventResponse = response;
|
|
8965
8975
|
return this.postCompleteTaskIfRequired();
|
|
@@ -8981,10 +8991,13 @@ class CaseEditComponent {
|
|
|
8981
8991
|
this.isSubmitting = false;
|
|
8982
8992
|
}
|
|
8983
8993
|
else {
|
|
8994
|
+
this.sessionStorageService.setItem('taskCompletionError', 'true');
|
|
8984
8995
|
// task assignment/completion error - handled within workallocation service
|
|
8985
8996
|
// could set task to be deleted (or completed later)?
|
|
8986
|
-
// note: think error messages only shown if user is caseworker - might reqauire changing
|
|
8987
8997
|
this.finishEventCompletionLogic(eventResponse);
|
|
8998
|
+
// below allows error to be shown on navigation to confirmation page
|
|
8999
|
+
this.alertService.setPreserveAlerts(true);
|
|
9000
|
+
this.alertService.error({ phrase: Constants.TASK_COMPLETION_ERROR });
|
|
8988
9001
|
}
|
|
8989
9002
|
});
|
|
8990
9003
|
}
|
|
@@ -9040,14 +9053,14 @@ class CaseEditComponent {
|
|
|
9040
9053
|
}
|
|
9041
9054
|
CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
|
|
9042
9055
|
CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
|
|
9043
|
-
CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.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)); };
|
|
9056
|
+
CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.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)); };
|
|
9044
9057
|
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) {
|
|
9045
9058
|
i0.ɵɵelement(0, "router-outlet");
|
|
9046
9059
|
} }, dependencies: [i1$1.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%}.no-bottom-border[_ngcontent-%COMP%]{border-bottom:none}.case-field-change[_ngcontent-%COMP%]{width:5%}"] });
|
|
9047
9060
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
|
|
9048
9061
|
type: Component,
|
|
9049
9062
|
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%}.no-bottom-border{border-bottom:none}.case-field-change{width:5%}\n"] }]
|
|
9050
|
-
}], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: WorkAllocationService }]; }, { eventTrigger: [{
|
|
9063
|
+
}], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$1.Router }, { type: i1$1.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: [{
|
|
9051
9064
|
type: Input
|
|
9052
9065
|
}], submit: [{
|
|
9053
9066
|
type: Input
|
|
@@ -9610,7 +9623,7 @@ function CaseEditPageComponent_ccd_case_event_completion_11_Template(rf, ctx) {
|
|
|
9610
9623
|
i0.ɵɵproperty("eventCompletionParams", ctx_r8.caseEdit.eventCompletionParams);
|
|
9611
9624
|
} }
|
|
9612
9625
|
class CaseEditPageComponent {
|
|
9613
|
-
constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
|
|
9626
|
+
constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService, addressService) {
|
|
9614
9627
|
this.caseEdit = caseEdit;
|
|
9615
9628
|
this.route = route;
|
|
9616
9629
|
this.formValueService = formValueService;
|
|
@@ -9622,6 +9635,7 @@ class CaseEditPageComponent {
|
|
|
9622
9635
|
this.caseEditDataService = caseEditDataService;
|
|
9623
9636
|
this.loadingService = loadingService;
|
|
9624
9637
|
this.validPageListCaseFieldsService = validPageListCaseFieldsService;
|
|
9638
|
+
this.addressService = addressService;
|
|
9625
9639
|
this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
|
|
9626
9640
|
this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
|
|
9627
9641
|
this.formValuesChanged = false;
|
|
@@ -9744,7 +9758,14 @@ class CaseEditPageComponent {
|
|
|
9744
9758
|
}
|
|
9745
9759
|
}
|
|
9746
9760
|
if (fieldElement.hasError('required')) {
|
|
9747
|
-
|
|
9761
|
+
if (casefield.id === 'AddressLine1') {
|
|
9762
|
+
// EUI-1067 - Display more relevant error message to user and correctly navigate to the field
|
|
9763
|
+
this.addressService.setMandatoryError(true);
|
|
9764
|
+
this.caseEditDataService.addFormValidationError({ id: `${path}_${path}`, message: `An address is required` });
|
|
9765
|
+
}
|
|
9766
|
+
else {
|
|
9767
|
+
this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
|
|
9768
|
+
}
|
|
9748
9769
|
fieldElement.markAsDirty();
|
|
9749
9770
|
// For the JudicialUser field type, an error needs to be set on the component so that an error message
|
|
9750
9771
|
// can be displayed at field level
|
|
@@ -9819,6 +9840,7 @@ class CaseEditPageComponent {
|
|
|
9819
9840
|
}
|
|
9820
9841
|
}
|
|
9821
9842
|
if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
|
|
9843
|
+
this.addressService.setMandatoryError(false);
|
|
9822
9844
|
console.log('Case Edit Error', this.caseEdit.error);
|
|
9823
9845
|
if (this.caseEdit.validPageList.findIndex(page => page.id === this.currentPage.id) === -1) {
|
|
9824
9846
|
this.caseEdit.validPageList.push(this.currentPage);
|
|
@@ -10118,7 +10140,7 @@ CaseEditPageComponent.RESUMED_FORM_SAVE = 'RESUMED_FORM_SAVE';
|
|
|
10118
10140
|
CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
|
|
10119
10141
|
CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
|
|
10120
10142
|
CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
|
|
10121
|
-
CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatLegacyDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
|
|
10143
|
+
CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatLegacyDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(AddressesService)); };
|
|
10122
10144
|
CaseEditPageComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵ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) { if (rf & 1) {
|
|
10123
10145
|
i0.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
|
|
10124
10146
|
i0.ɵɵtemplate(1, CaseEditPageComponent_div_1_Template, 1, 0, "div", 1);
|
|
@@ -10153,7 +10175,7 @@ CaseEditPageComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseE
|
|
|
10153
10175
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditPageComponent, [{
|
|
10154
10176
|
type: Component,
|
|
10155
10177
|
args: [{ selector: 'ccd-case-edit-page', template: "<ng-container *ngIf=\"currentPage\">\n <h1 *ngIf=\"!currentPage.label\" class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n <ng-container *ngIf=\"currentPage.label\">\n <span class=\"govuk-caption-l\">{{ eventTrigger.name | rpxTranslate}}</span>\n <h1 class=\"govuk-heading-l\">{{currentPage.label | rpxTranslate}}</h1>\n </ng-container>\n</ng-container>\n\n<!--Case ID or Title -->\n<div *ngIf=\"getCaseTitle(); then titleBlock; else idBlock\"></div>\n<ng-template #titleBlock>\n <ccd-markdown [content]=\"getCaseTitle() | ccdCaseTitle: caseFields : editForm.controls['data']\"></ccd-markdown>\n</ng-template>\n<ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n</ng-template>\n\n<!-- Error message summary -->\n<div *ngIf=\"validationErrors.length > 0\" class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\" data-module=\"govuk-error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{'There is a problem' | rpxTranslate}}\n </h2>\n <div *ngFor=\"let validationError of validationErrors\" class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li>\n <a (click)=\"navigateToErrorElement(validationError.id)\" class=\"validation-error\">\n {{ validationError.message | rpxTranslate: getRpxTranslatePipeArgs(validationError.label | rpxTranslate): null }}\n </a>\n </li>\n </ul>\n </div>\n</div>\n\n<ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n<ccd-callback-errors\n [triggerTextContinue]=\"triggerTextStart\"\n [triggerTextIgnore]=\"triggerTextIgnoreWarnings\"\n [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\">\n</ccd-callback-errors>\n<div class=\"width-50\">\n <form *ngIf=\"currentPage\" class=\"form\" [formGroup]=\"editForm\" (submit)=\"submit()\">\n <fieldset id=\"fieldset-case-data\">\n <legend style=\"display: none;\"></legend>\n <!-- single column -->\n <ccd-case-edit-form id='caseEditForm' *ngIf=\"!currentPage.isMultiColumn()\" [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"\n [pageChangeSubject]=\"pageChangeSubject\"\n (valuesChanged)=\"applyValuesChanged($event)\"></ccd-case-edit-form>\n <!-- two columns -->\n <div *ngIf=\"currentPage.isMultiColumn()\" class=\"grid-row\">\n <div class=\"column-two-thirds rightBorderSeparator\">\n <ccd-case-edit-form id='caseEditForm1' [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n <div class=\"column-one-third\">\n <ccd-case-edit-form id='caseEditForm2' [fields]=\"currentPage.getCol2Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n </div>\n </fieldset>\n\n <div class=\"form-group form-group-related\">\n <button class=\"button button-secondary\" type=\"button\" [disabled]=\"!(hasPreviousPage$ | async)\" (click)=\"toPreviousPage()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button class=\"button\" type=\"submit\" [disabled]=\"submitting()\">{{triggerText | rpxTranslate}}</button>\n </div>\n\n <p class=\"cancel\"><a (click)=\"cancel()\" href=\"javascript:void(0)\">{{getCancelText() | rpxTranslate}}</a></p>\n </form>\n</div>\n\n<ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n</ccd-case-event-completion>\n", styles: [".rightBorderSeparator{border-right-width:4px;border-right-color:#ffcc02;border-right-style:solid}.validation-error{cursor:pointer;text-decoration:underline;color:#d4351c}\n"] }]
|
|
10156
|
-
}], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatLegacyDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null); })();
|
|
10178
|
+
}], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatLegacyDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: AddressesService }]; }, null); })();
|
|
10157
10179
|
|
|
10158
10180
|
class CallbackErrorsContext {
|
|
10159
10181
|
}
|
|
@@ -10600,6 +10622,17 @@ class AddressOption {
|
|
|
10600
10622
|
}
|
|
10601
10623
|
}
|
|
10602
10624
|
|
|
10625
|
+
class AddressValidationConstants {
|
|
10626
|
+
}
|
|
10627
|
+
// allow alpha-numeric characters and spaces possibly between a connecting - character
|
|
10628
|
+
// this applies validation while allowing partial postcodes
|
|
10629
|
+
AddressValidationConstants.REGEX_POSTCODE = /^([A-Za-z0-9]-*| )+$/;
|
|
10630
|
+
AddressValidationConstants.ɵfac = function AddressValidationConstants_Factory(t) { return new (t || AddressValidationConstants)(); };
|
|
10631
|
+
AddressValidationConstants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AddressValidationConstants, factory: AddressValidationConstants.ɵfac });
|
|
10632
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddressValidationConstants, [{
|
|
10633
|
+
type: Injectable
|
|
10634
|
+
}], null, null); })();
|
|
10635
|
+
|
|
10603
10636
|
class FieldsFilterPipe {
|
|
10604
10637
|
/**
|
|
10605
10638
|
* Complex type should have at least on simple field descendant with a value.
|
|
@@ -10866,8 +10899,9 @@ function WriteAddressFieldComponent_div_1_div_4_span_5_Template(rf, ctx) { if (r
|
|
|
10866
10899
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10867
10900
|
i0.ɵɵelementEnd();
|
|
10868
10901
|
} if (rf & 2) {
|
|
10902
|
+
const ctx_r5 = i0.ɵɵnextContext(3);
|
|
10869
10903
|
i0.ɵɵadvance(1);
|
|
10870
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1,
|
|
10904
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r5.errorMessage));
|
|
10871
10905
|
} }
|
|
10872
10906
|
const _c1$n = function (a0) { return { "form-group-error": a0 }; };
|
|
10873
10907
|
const _c2$2 = function (a0) { return { "govuk-input--error": a0 }; };
|
|
@@ -10898,42 +10932,56 @@ function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) { if (rf & 1)
|
|
|
10898
10932
|
i0.ɵɵadvance(2);
|
|
10899
10933
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(9, 11, "Find address"));
|
|
10900
10934
|
} }
|
|
10901
|
-
function
|
|
10935
|
+
function WriteAddressFieldComponent_div_1_div_5_span_5_Template(rf, ctx) { if (rf & 1) {
|
|
10936
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
10937
|
+
i0.ɵɵtext(1);
|
|
10938
|
+
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10939
|
+
i0.ɵɵelementEnd();
|
|
10940
|
+
} if (rf & 2) {
|
|
10941
|
+
const ctx_r8 = i0.ɵɵnextContext(3);
|
|
10942
|
+
i0.ɵɵadvance(1);
|
|
10943
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r8.errorMessage));
|
|
10944
|
+
} }
|
|
10945
|
+
function WriteAddressFieldComponent_div_1_div_5_option_7_Template(rf, ctx) { if (rf & 1) {
|
|
10902
10946
|
i0.ɵɵelementStart(0, "option", 18);
|
|
10903
10947
|
i0.ɵɵtext(1);
|
|
10904
10948
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10905
10949
|
i0.ɵɵelementEnd();
|
|
10906
10950
|
} if (rf & 2) {
|
|
10907
|
-
const
|
|
10908
|
-
i0.ɵɵproperty("ngValue",
|
|
10951
|
+
const addressOption_r10 = ctx.$implicit;
|
|
10952
|
+
i0.ɵɵproperty("ngValue", addressOption_r10.value);
|
|
10909
10953
|
i0.ɵɵadvance(1);
|
|
10910
|
-
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2,
|
|
10954
|
+
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, addressOption_r10.description), " ");
|
|
10911
10955
|
} }
|
|
10912
10956
|
function WriteAddressFieldComponent_div_1_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
10913
|
-
const
|
|
10957
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
10914
10958
|
i0.ɵɵelementStart(0, "div", 15)(1, "label", 9)(2, "span", 10);
|
|
10915
10959
|
i0.ɵɵtext(3);
|
|
10916
10960
|
i0.ɵɵpipe(4, "rpxTranslate");
|
|
10917
10961
|
i0.ɵɵelementEnd()();
|
|
10918
|
-
i0.ɵɵ
|
|
10919
|
-
i0.ɵɵ
|
|
10920
|
-
i0.ɵɵ
|
|
10962
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_span_5_Template, 3, 3, "span", 11);
|
|
10963
|
+
i0.ɵɵelementStart(6, "select", 16);
|
|
10964
|
+
i0.ɵɵlistener("change", function WriteAddressFieldComponent_div_1_div_5_Template_select_change_6_listener() { i0.ɵɵrestoreView(_r12); const ctx_r11 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r11.addressSelected()); });
|
|
10965
|
+
i0.ɵɵtemplate(7, WriteAddressFieldComponent_div_1_div_5_option_7_Template, 3, 4, "option", 17);
|
|
10921
10966
|
i0.ɵɵelementEnd()();
|
|
10922
10967
|
} if (rf & 2) {
|
|
10923
10968
|
const ctx_r3 = i0.ɵɵnextContext(2);
|
|
10969
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1$n, ctx_r3.noAddressSelected));
|
|
10924
10970
|
i0.ɵɵadvance(1);
|
|
10925
10971
|
i0.ɵɵproperty("for", ctx_r3.createElementId("addressList"));
|
|
10926
10972
|
i0.ɵɵadvance(2);
|
|
10927
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4,
|
|
10973
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 7, "Select an address"));
|
|
10928
10974
|
i0.ɵɵadvance(2);
|
|
10975
|
+
i0.ɵɵproperty("ngIf", ctx_r3.noAddressSelected);
|
|
10976
|
+
i0.ɵɵadvance(1);
|
|
10929
10977
|
i0.ɵɵproperty("id", ctx_r3.createElementId("addressList"))("formControl", ctx_r3.addressList);
|
|
10930
10978
|
i0.ɵɵadvance(1);
|
|
10931
10979
|
i0.ɵɵproperty("ngForOf", ctx_r3.addressOptions);
|
|
10932
10980
|
} }
|
|
10933
10981
|
function WriteAddressFieldComponent_div_1_a_6_Template(rf, ctx) { if (rf & 1) {
|
|
10934
|
-
const
|
|
10982
|
+
const _r14 = i0.ɵɵgetCurrentView();
|
|
10935
10983
|
i0.ɵɵelementStart(0, "a", 19);
|
|
10936
|
-
i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(
|
|
10984
|
+
i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r13.blankAddress()); });
|
|
10937
10985
|
i0.ɵɵtext(1);
|
|
10938
10986
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10939
10987
|
i0.ɵɵelementEnd();
|
|
@@ -10947,7 +10995,7 @@ function WriteAddressFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
10947
10995
|
i0.ɵɵpipe(3, "ccdFieldLabel");
|
|
10948
10996
|
i0.ɵɵelementEnd();
|
|
10949
10997
|
i0.ɵɵtemplate(4, WriteAddressFieldComponent_div_1_div_4_Template, 10, 17, "div", 5);
|
|
10950
|
-
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template,
|
|
10998
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template, 8, 11, "div", 6);
|
|
10951
10999
|
i0.ɵɵtemplate(6, WriteAddressFieldComponent_div_1_a_6_Template, 3, 3, "a", 7);
|
|
10952
11000
|
i0.ɵɵelementEnd();
|
|
10953
11001
|
} if (rf & 2) {
|
|
@@ -10966,19 +11014,30 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
10966
11014
|
super();
|
|
10967
11015
|
this.isCompoundPipe = isCompoundPipe;
|
|
10968
11016
|
this.addressFormGroup = new FormGroup({});
|
|
11017
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
10969
11018
|
this.missingPostcode = false;
|
|
11019
|
+
this.noAddressSelected = false;
|
|
10970
11020
|
this.addressesService = addressesService;
|
|
10971
11021
|
}
|
|
10972
11022
|
ngOnInit() {
|
|
10973
11023
|
if (!this.isComplexWithHiddenFields()) {
|
|
10974
|
-
this.postcode = new FormControl('');
|
|
10975
|
-
this.
|
|
11024
|
+
this.postcode = new FormControl('', [Validators.required]);
|
|
11025
|
+
this.formGroup.addControl('postcode', this.postcode);
|
|
10976
11026
|
this.addressList = new FormControl('');
|
|
10977
|
-
this.
|
|
11027
|
+
this.formGroup.addControl('address', this.addressList);
|
|
10978
11028
|
}
|
|
11029
|
+
this.addressesService.getMandatoryError().subscribe((value) => {
|
|
11030
|
+
this.updateErrorsOnContinue(value);
|
|
11031
|
+
});
|
|
10979
11032
|
}
|
|
10980
11033
|
findAddress() {
|
|
11034
|
+
this.noAddressSelected = false;
|
|
10981
11035
|
if (!this.postcode.value) {
|
|
11036
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
11037
|
+
this.missingPostcode = true;
|
|
11038
|
+
}
|
|
11039
|
+
else if (!this.postcode.value.trim().match(AddressValidationConstants.REGEX_POSTCODE)) {
|
|
11040
|
+
this.errorMessage = WriteAddressFieldComponent.INVALID_ERROR_MESSAGE;
|
|
10982
11041
|
this.missingPostcode = true;
|
|
10983
11042
|
}
|
|
10984
11043
|
else {
|
|
@@ -11007,6 +11066,8 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11007
11066
|
blankAddress() {
|
|
11008
11067
|
this.caseField.value = new AddressModel();
|
|
11009
11068
|
this.setFormValue();
|
|
11069
|
+
this.missingPostcode = false;
|
|
11070
|
+
this.noAddressSelected = false;
|
|
11010
11071
|
}
|
|
11011
11072
|
isComplexWithHiddenFields() {
|
|
11012
11073
|
if (this.caseField.isComplex() && this.caseField.field_type.complex_fields
|
|
@@ -11038,6 +11099,7 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11038
11099
|
addressSelected() {
|
|
11039
11100
|
this.caseField.value = this.addressList.value;
|
|
11040
11101
|
this.setFormValue();
|
|
11102
|
+
this.noAddressSelected = false;
|
|
11041
11103
|
}
|
|
11042
11104
|
ngOnChanges(changes) {
|
|
11043
11105
|
super.ngOnChanges(changes);
|
|
@@ -11058,7 +11120,14 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11058
11120
|
this.writeComplexFieldComponent.complexGroup.setValue(this.caseField.value);
|
|
11059
11121
|
}
|
|
11060
11122
|
}
|
|
11123
|
+
updateErrorsOnContinue(value) {
|
|
11124
|
+
this.missingPostcode = value && !this.shouldShowDetailFields() && !this.addressOptions;
|
|
11125
|
+
this.noAddressSelected = value && !this.shouldShowDetailFields() && !!this.addressOptions;
|
|
11126
|
+
this.errorMessage = this.noAddressSelected ? 'Select an address' : this.errorMessage;
|
|
11127
|
+
}
|
|
11061
11128
|
}
|
|
11129
|
+
WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE = 'Enter a Postcode';
|
|
11130
|
+
WriteAddressFieldComponent.INVALID_ERROR_MESSAGE = 'Enter a valid Postcode';
|
|
11062
11131
|
WriteAddressFieldComponent.ɵfac = function WriteAddressFieldComponent_Factory(t) { return new (t || WriteAddressFieldComponent)(i0.ɵɵdirectiveInject(AddressesService), i0.ɵɵdirectiveInject(IsCompoundPipe)); };
|
|
11063
11132
|
WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteAddressFieldComponent, selectors: [["ccd-write-address-field"]], viewQuery: function WriteAddressFieldComponent_Query(rf, ctx) { if (rf & 1) {
|
|
11064
11133
|
i0.ɵɵviewQuery(_c0$U, 5);
|
|
@@ -11067,7 +11136,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11067
11136
|
let _t;
|
|
11068
11137
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
|
|
11069
11138
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.focusElementDirectives = _t);
|
|
11070
|
-
} }, inputs: { formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 9, consts: [[1, "form-group", 3, "id"], [4, "ngIf"], [3, "hidden", "caseField", "renderLabel", "parent", "formGroup", "ignoreMandatory", "idPrefix"], ["writeComplexFieldComponent", ""], [1, "heading-h2"], ["class", "form-group bottom-30 postcodeLookup", 3, "id", "ngClass", 4, "ngIf"], ["class", "form-group", "id", "selectAddress", 4, "ngIf"], ["class", "manual-link bottom-30", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], [1, "form-group", "bottom-30", "postcodeLookup", 3, "id", "ngClass"], [3, "for"], [1, "form-label"], ["class", "error-message", 4, "ngIf"], ["type", "text", "name", "postcode", 1, "form-control", "postcodeinput", "inline-block", 3, "ngClass", "id", "formControl"], ["type", "button", 1, "button", "button-30", 3, "click"], [1, "error-message"], ["id", "selectAddress", 1, "form-group"], ["name", "address", "focusElement", "", 1, "form-control", "ccd-dropdown", "addressList", 3, "id", "formControl", "change"], [3, "ngValue", 4, "ngFor", "ngForOf"], [3, "ngValue"], ["href", "javascript:void(0)", 1, "manual-link", "bottom-30", 3, "click"]], template: function WriteAddressFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
11139
|
+
} }, inputs: { formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 9, consts: [[1, "form-group", 3, "id"], [4, "ngIf"], [3, "hidden", "caseField", "renderLabel", "parent", "formGroup", "ignoreMandatory", "idPrefix"], ["writeComplexFieldComponent", ""], [1, "heading-h2"], ["class", "form-group bottom-30 postcodeLookup", 3, "id", "ngClass", 4, "ngIf"], ["class", "form-group", "id", "selectAddress", 3, "ngClass", 4, "ngIf"], ["class", "manual-link bottom-30", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], [1, "form-group", "bottom-30", "postcodeLookup", 3, "id", "ngClass"], [3, "for"], [1, "form-label"], ["class", "error-message", 4, "ngIf"], ["type", "text", "name", "postcode", 1, "form-control", "postcodeinput", "inline-block", 3, "ngClass", "id", "formControl"], ["type", "button", 1, "button", "button-30", 3, "click"], [1, "error-message"], ["id", "selectAddress", 1, "form-group", 3, "ngClass"], ["name", "address", "focusElement", "", 1, "form-control", "ccd-dropdown", "addressList", 3, "id", "formControl", "change"], [3, "ngValue", 4, "ngFor", "ngForOf"], [3, "ngValue"], ["href", "javascript:void(0)", 1, "manual-link", "bottom-30", 3, "click"]], template: function WriteAddressFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
11071
11140
|
i0.ɵɵelementStart(0, "div", 0);
|
|
11072
11141
|
i0.ɵɵtemplate(1, WriteAddressFieldComponent_div_1_Template, 7, 6, "div", 1);
|
|
11073
11142
|
i0.ɵɵelement(2, "ccd-write-complex-type-field", 2, 3);
|
|
@@ -11081,7 +11150,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11081
11150
|
} }, styles: [".manual-link[_ngcontent-%COMP%]{cursor:pointer;display:block;text-decoration:underline}"] });
|
|
11082
11151
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteAddressFieldComponent, [{
|
|
11083
11152
|
type: Component,
|
|
11084
|
-
args: [{ selector: 'ccd-write-address-field', template: "<div class=\"form-group\" [id]=\"id()\">\n <div *ngIf=\"!isComplexWithHiddenFields()\">\n <h2 class=\"heading-h2\">{{caseField | ccdFieldLabel}}</h2>\n\n <div class=\"form-group bottom-30 postcodeLookup\" [id]=\"createElementId('postcodeLookup')\" [ngClass]=\"{'form-group-error': missingPostcode}\" *ngIf=\"!isExpanded\">\n <label [for]=\"createElementId('postcodeInput')\">\n <span class=\"form-label\">{{'Enter a UK postcode' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"missingPostcode\">{{
|
|
11153
|
+
args: [{ selector: 'ccd-write-address-field', template: "<div class=\"form-group\" [id]=\"id()\">\n <div *ngIf=\"!isComplexWithHiddenFields()\">\n <h2 class=\"heading-h2\">{{caseField | ccdFieldLabel}}</h2>\n\n <div class=\"form-group bottom-30 postcodeLookup\" [id]=\"createElementId('postcodeLookup')\" [ngClass]=\"{'form-group-error': missingPostcode}\" *ngIf=\"!isExpanded\">\n <label [for]=\"createElementId('postcodeInput')\">\n <span class=\"form-label\">{{'Enter a UK postcode' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"missingPostcode\">{{errorMessage | rpxTranslate}}</span>\n <input type=\"text\" [ngClass]=\"{'govuk-input--error': missingPostcode}\"\n [id]=\"createElementId('postcodeInput')\" name=\"postcode\" class=\"form-control postcodeinput inline-block\" [formControl]=\"postcode\">\n <button type=\"button\" class=\"button button-30\" (click)=\"findAddress()\">{{'Find address' | rpxTranslate}}</button>\n </div>\n\n <div class=\"form-group\" *ngIf=\"addressOptions\" id=\"selectAddress\" [ngClass]=\"{'form-group-error': noAddressSelected}\">\n <label [for]=\"createElementId('addressList')\">\n <span class=\"form-label\">{{'Select an address' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"noAddressSelected\">{{errorMessage | rpxTranslate}}</span>\n <select class=\"form-control ccd-dropdown addressList\" [id]=\"createElementId('addressList')\" name=\"address\" [formControl]=\"addressList\" (change)=\"addressSelected()\" focusElement>\n <option *ngFor=\"let addressOption of addressOptions\" [ngValue]=\"addressOption.value\">\n {{addressOption.description | rpxTranslate}}\n </option>\n </select>\n </div>\n\n <a class=\"manual-link bottom-30\" *ngIf=\"!shouldShowDetailFields()\" (click)=\"blankAddress()\" href=\"javascript:void(0)\">\n {{\"I can't enter a UK postcode\" | rpxTranslate}}\n </a>\n </div>\n\n <ccd-write-complex-type-field\n [hidden]=\"!shouldShowDetailFields()\"\n [caseField]=\"caseField\"\n [renderLabel]=\"false\"\n [parent]=\"parent\"\n [formGroup]=\"formGroup\"\n [ignoreMandatory]=\"true\"\n [idPrefix]=\"buildIdPrefix('detail')\"\n #writeComplexFieldComponent>\n </ccd-write-complex-type-field>\n</div>\n", styles: [".manual-link{cursor:pointer;display:block;text-decoration:underline}\n"] }]
|
|
11085
11154
|
}], function () { return [{ type: AddressesService }, { type: IsCompoundPipe }]; }, { writeComplexFieldComponent: [{
|
|
11086
11155
|
type: ViewChild,
|
|
11087
11156
|
args: ['writeComplexFieldComponent', { static: false }]
|
|
@@ -11788,7 +11857,7 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11788
11857
|
// Extract all flags-related data from the CaseEventTrigger object in the snapshot data
|
|
11789
11858
|
if (this.route.snapshot.data.eventTrigger) {
|
|
11790
11859
|
// Get the HMCTSServiceId from supplementary data, if it exists (required for retrieving the available flag types in
|
|
11791
|
-
// the first instance, only falling back on case type ID or
|
|
11860
|
+
// the first instance, only falling back on case type ID or jurisdiction if it's not present)
|
|
11792
11861
|
if (this.route.snapshot.data.eventTrigger.supplementary_data
|
|
11793
11862
|
&& this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId) {
|
|
11794
11863
|
this.hmctsServiceId = this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId;
|
|
@@ -12129,32 +12198,36 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
12129
12198
|
this.flagCommentsOptional = true;
|
|
12130
12199
|
}
|
|
12131
12200
|
populateNewFlagDetailInstance() {
|
|
12201
|
+
const langSearchTerm = this.caseFlagParentFormGroup?.value['languageSearchTerm'];
|
|
12202
|
+
const manualLangEntry = this.caseFlagParentFormGroup?.value['manualLanguageEntry'];
|
|
12203
|
+
const flagType = this.caseFlagParentFormGroup?.value['flagType'];
|
|
12204
|
+
const otherDesc = this.caseFlagParentFormGroup?.value['otherDescription'];
|
|
12132
12205
|
const formValues = this.caseFlagParentFormGroup?.value;
|
|
12133
12206
|
return {
|
|
12134
|
-
name:
|
|
12135
|
-
name_cy:
|
|
12207
|
+
name: this.flagType?.name,
|
|
12208
|
+
name_cy: flagType?.name_cy,
|
|
12136
12209
|
// Currently, subTypeValue, subTypeValue_cy and subTypeKey are applicable only to language flag types
|
|
12137
|
-
subTypeValue:
|
|
12138
|
-
?
|
|
12139
|
-
:
|
|
12140
|
-
?
|
|
12210
|
+
subTypeValue: langSearchTerm && this.rpxTranslationService.language === 'en'
|
|
12211
|
+
? langSearchTerm.value
|
|
12212
|
+
: manualLangEntry && this.rpxTranslationService.language === 'en'
|
|
12213
|
+
? manualLangEntry
|
|
12141
12214
|
: null,
|
|
12142
|
-
subTypeValue_cy:
|
|
12143
|
-
?
|
|
12144
|
-
:
|
|
12145
|
-
?
|
|
12215
|
+
subTypeValue_cy: langSearchTerm && this.rpxTranslationService.language === 'cy'
|
|
12216
|
+
? langSearchTerm?.value_cy
|
|
12217
|
+
: manualLangEntry && this.rpxTranslationService.language === 'cy'
|
|
12218
|
+
? manualLangEntry
|
|
12146
12219
|
: null,
|
|
12147
12220
|
// For user-entered (i.e. non-Reference Data) languages, there is no key
|
|
12148
|
-
subTypeKey:
|
|
12149
|
-
?
|
|
12221
|
+
subTypeKey: langSearchTerm
|
|
12222
|
+
? langSearchTerm.key
|
|
12150
12223
|
: null,
|
|
12151
|
-
otherDescription:
|
|
12152
|
-
|
|
12153
|
-
?
|
|
12224
|
+
otherDescription: flagType?.flagCode === this.otherFlagTypeCode &&
|
|
12225
|
+
otherDesc && this.rpxTranslationService.language === 'en'
|
|
12226
|
+
? otherDesc
|
|
12154
12227
|
: null,
|
|
12155
|
-
otherDescription_cy:
|
|
12156
|
-
|
|
12157
|
-
?
|
|
12228
|
+
otherDescription_cy: flagType?.flagCode === this.otherFlagTypeCode &&
|
|
12229
|
+
otherDesc && this.rpxTranslationService.language === 'cy'
|
|
12230
|
+
? otherDesc
|
|
12158
12231
|
: null,
|
|
12159
12232
|
flagComment: this.rpxTranslationService.language === 'en'
|
|
12160
12233
|
? formValues?.flagComments
|
|
@@ -12164,18 +12237,18 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
12164
12237
|
: null,
|
|
12165
12238
|
flagUpdateComment: formValues?.statusReason,
|
|
12166
12239
|
dateTimeCreated: new Date().toISOString(),
|
|
12167
|
-
path:
|
|
12168
|
-
|
|
12169
|
-
hearingRelevant:
|
|
12170
|
-
flagCode:
|
|
12240
|
+
path: flagType?.Path &&
|
|
12241
|
+
flagType?.Path.map(pathValue => Object.assign({ id: null, value: pathValue })),
|
|
12242
|
+
hearingRelevant: flagType?.hearingRelevant ? 'Yes' : 'No',
|
|
12243
|
+
flagCode: flagType?.flagCode,
|
|
12171
12244
|
// Status should be set to whatever the default is for this flag type, if flag is being created by an external
|
|
12172
12245
|
// user, otherwise it should be set to "Active" if Case Flags v2.1 is NOT enabled, or the selected status if it is
|
|
12173
12246
|
status: this.isDisplayContextParameterExternal
|
|
12174
|
-
?
|
|
12247
|
+
? flagType?.defaultStatus
|
|
12175
12248
|
: !this.isDisplayContextParameter2Point1Enabled
|
|
12176
12249
|
? CaseFlagStatus.ACTIVE
|
|
12177
12250
|
: CaseFlagStatus[formValues?.selectedStatus],
|
|
12178
|
-
availableExternally:
|
|
12251
|
+
availableExternally: flagType?.externallyAvailable ? 'Yes' : 'No'
|
|
12179
12252
|
};
|
|
12180
12253
|
}
|
|
12181
12254
|
moveToFinalReviewStage() {
|
|
@@ -30099,7 +30172,7 @@ function CaseEventTriggerComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
30099
30172
|
i0.ɵɵproperty("caseDetails", ctx_r0.caseDetails)("submit", ctx_r0.submit())("validate", ctx_r0.validate())("eventTrigger", ctx_r0.eventTrigger);
|
|
30100
30173
|
} }
|
|
30101
30174
|
class CaseEventTriggerComponent {
|
|
30102
|
-
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService) {
|
|
30175
|
+
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService, sessionStorageService) {
|
|
30103
30176
|
this.ngZone = ngZone;
|
|
30104
30177
|
this.casesService = casesService;
|
|
30105
30178
|
this.caseNotifier = caseNotifier;
|
|
@@ -30108,6 +30181,7 @@ class CaseEventTriggerComponent {
|
|
|
30108
30181
|
this.route = route;
|
|
30109
30182
|
this.caseReferencePipe = caseReferencePipe;
|
|
30110
30183
|
this.activityPollingService = activityPollingService;
|
|
30184
|
+
this.sessionStorageService = sessionStorageService;
|
|
30111
30185
|
this.BANNER = DisplayMode.BANNER;
|
|
30112
30186
|
}
|
|
30113
30187
|
ngOnInit() {
|
|
@@ -30156,21 +30230,30 @@ class CaseEventTriggerComponent {
|
|
|
30156
30230
|
}
|
|
30157
30231
|
submitted(event) {
|
|
30158
30232
|
const eventStatus = event['status'];
|
|
30233
|
+
const taskCompletionFailed = this.sessionStorageService.getItem('taskCompletionError') === 'true';
|
|
30159
30234
|
this.router
|
|
30160
30235
|
.navigate([this.parentUrl])
|
|
30161
30236
|
.then(() => {
|
|
30162
30237
|
const caseReference = this.caseReferencePipe.transform(this.caseDetails.case_id.toString());
|
|
30163
30238
|
const replacements = { CASEREFERENCE: caseReference, NAME: this.eventTrigger.name };
|
|
30164
|
-
|
|
30239
|
+
this.alertService.setPreserveAlerts(true);
|
|
30240
|
+
if (taskCompletionFailed) {
|
|
30241
|
+
// if task still present in session storage, we know that the task has not been correctly completed
|
|
30242
|
+
this.alertService.warning({
|
|
30243
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + '. ' + Constants.TASK_COMPLETION_ERROR,
|
|
30244
|
+
replacements
|
|
30245
|
+
});
|
|
30246
|
+
this.sessionStorageService.removeItem('taskCompletionError');
|
|
30247
|
+
}
|
|
30248
|
+
else if (EventStatusService.isIncomplete(eventStatus)) {
|
|
30165
30249
|
this.alertService.warning({
|
|
30166
|
-
phrase:
|
|
30167
|
-
but the callback service cannot be completed`,
|
|
30250
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE,
|
|
30168
30251
|
replacements
|
|
30169
30252
|
});
|
|
30170
30253
|
}
|
|
30171
30254
|
else {
|
|
30172
30255
|
this.alertService.success({
|
|
30173
|
-
phrase:
|
|
30256
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE,
|
|
30174
30257
|
replacements,
|
|
30175
30258
|
preserve: true
|
|
30176
30259
|
});
|
|
@@ -30189,7 +30272,9 @@ class CaseEventTriggerComponent {
|
|
|
30189
30272
|
return !!(this.eventTrigger && this.caseDetails);
|
|
30190
30273
|
}
|
|
30191
30274
|
}
|
|
30192
|
-
CaseEventTriggerComponent
|
|
30275
|
+
CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE = `Case #%CASEREFERENCE% has been updated with event: %NAME%`;
|
|
30276
|
+
CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE = ' but the callback service cannot be completed';
|
|
30277
|
+
CaseEventTriggerComponent.ɵfac = function CaseEventTriggerComponent_Factory(t) { return new (t || CaseEventTriggerComponent)(i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseReferencePipe), i0.ɵɵdirectiveInject(ActivityPollingService), i0.ɵɵdirectiveInject(SessionStorageService)); };
|
|
30193
30278
|
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) {
|
|
30194
30279
|
i0.ɵɵtemplate(0, CaseEventTriggerComponent_div_0_Template, 3, 6, "div", 0);
|
|
30195
30280
|
} if (rf & 2) {
|
|
@@ -30198,7 +30283,7 @@ CaseEventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: C
|
|
|
30198
30283
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventTriggerComponent, [{
|
|
30199
30284
|
type: Component,
|
|
30200
30285
|
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" }]
|
|
30201
|
-
}], function () { return [{ type: i0.NgZone }, { type: CasesService }, { type: CaseNotifier }, { type: i1$1.Router }, { type: AlertService }, { type: i1$1.ActivatedRoute }, { type: CaseReferencePipe }, { type: ActivityPollingService }]; }, null); })();
|
|
30286
|
+
}], function () { return [{ type: i0.NgZone }, { type: CasesService }, { type: CaseNotifier }, { type: i1$1.Router }, { type: AlertService }, { type: i1$1.ActivatedRoute }, { type: CaseReferencePipe }, { type: ActivityPollingService }, { type: SessionStorageService }]; }, null); })();
|
|
30202
30287
|
|
|
30203
30288
|
function CaseViewComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
30204
30289
|
i0.ɵɵelementStart(0, "div");
|