@hmcts/ccd-case-ui-toolkit 7.0.10 → 7.0.11-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 +11 -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/services/addresses/addresses.service.mjs +9 -1
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +118 -34
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +113 -34
- 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/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, of,
|
|
11
|
+
import { throwError, Subject, EMPTY, BehaviorSubject, Observable, 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, switchMap, debounceTime, publish, refCount, delay, distinctUntilChanged, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
|
|
@@ -4529,6 +4529,7 @@ class Constants {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
Constants.MANDATORY = 'MANDATORY';
|
|
4531
4531
|
Constants.REGEX_WHITESPACES = '^[^ ]+(?:\\s+[^ ]+)*$';
|
|
4532
|
+
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';
|
|
4532
4533
|
Constants.ɵfac = function Constants_Factory(t) { return new (t || Constants)(); };
|
|
4533
4534
|
Constants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: Constants, factory: Constants.ɵfac });
|
|
4534
4535
|
(function () {
|
|
@@ -6275,6 +6276,7 @@ class AddressesService {
|
|
|
6275
6276
|
constructor(http, appConfig) {
|
|
6276
6277
|
this.http = http;
|
|
6277
6278
|
this.appConfig = appConfig;
|
|
6279
|
+
this.mandatoryError = new BehaviorSubject(false);
|
|
6278
6280
|
}
|
|
6279
6281
|
getAddressesForPostcode(postcode) {
|
|
6280
6282
|
return this.http
|
|
@@ -6283,6 +6285,12 @@ class AddressesService {
|
|
|
6283
6285
|
.pipe(map(res => res.results))
|
|
6284
6286
|
.pipe(map(output => output.map(addresses => this.format(new AddressParser().parse(addresses[AddressType.DPA])))));
|
|
6285
6287
|
}
|
|
6288
|
+
getMandatoryError() {
|
|
6289
|
+
return this.mandatoryError.asObservable();
|
|
6290
|
+
}
|
|
6291
|
+
setMandatoryError(value) {
|
|
6292
|
+
this.mandatoryError.next(value);
|
|
6293
|
+
}
|
|
6286
6294
|
format(addressModel) {
|
|
6287
6295
|
return this.formatAddressLines(this.shiftAddressLinesUp(addressModel));
|
|
6288
6296
|
}
|
|
@@ -8954,7 +8962,7 @@ ValidPageListCaseFieldsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
|
|
|
8954
8962
|
})();
|
|
8955
8963
|
|
|
8956
8964
|
class CaseEditComponent {
|
|
8957
|
-
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService) {
|
|
8965
|
+
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService) {
|
|
8958
8966
|
this.fb = fb;
|
|
8959
8967
|
this.caseNotifier = caseNotifier;
|
|
8960
8968
|
this.router = router;
|
|
@@ -8970,6 +8978,7 @@ class CaseEditComponent {
|
|
|
8970
8978
|
this.loadingService = loadingService;
|
|
8971
8979
|
this.validPageListCaseFieldsService = validPageListCaseFieldsService;
|
|
8972
8980
|
this.workAllocationService = workAllocationService;
|
|
8981
|
+
this.alertService = alertService;
|
|
8973
8982
|
this.cancelled = new EventEmitter();
|
|
8974
8983
|
this.submitted = new EventEmitter();
|
|
8975
8984
|
this.isEventCompletionChecksRequired = false;
|
|
@@ -9258,6 +9267,7 @@ class CaseEditComponent {
|
|
|
9258
9267
|
const loadingSpinnerToken = this.loadingService.register();
|
|
9259
9268
|
// keep the initial event response to finalise process after task completion
|
|
9260
9269
|
let eventResponse;
|
|
9270
|
+
this.sessionStorageService.setItem('taskCompletionError', 'false');
|
|
9261
9271
|
submit(caseEventData).pipe(switchMap((response) => {
|
|
9262
9272
|
eventResponse = response;
|
|
9263
9273
|
return this.postCompleteTaskIfRequired();
|
|
@@ -9279,10 +9289,13 @@ class CaseEditComponent {
|
|
|
9279
9289
|
this.isSubmitting = false;
|
|
9280
9290
|
}
|
|
9281
9291
|
else {
|
|
9292
|
+
this.sessionStorageService.setItem('taskCompletionError', 'true');
|
|
9282
9293
|
// task assignment/completion error - handled within workallocation service
|
|
9283
9294
|
// could set task to be deleted (or completed later)?
|
|
9284
|
-
// note: think error messages only shown if user is caseworker - might reqauire changing
|
|
9285
9295
|
this.finishEventCompletionLogic(eventResponse);
|
|
9296
|
+
// below allows error to be shown on navigation to confirmation page
|
|
9297
|
+
this.alertService.setPreserveAlerts(true);
|
|
9298
|
+
this.alertService.error({ phrase: Constants.TASK_COMPLETION_ERROR });
|
|
9286
9299
|
}
|
|
9287
9300
|
});
|
|
9288
9301
|
}
|
|
@@ -9338,7 +9351,7 @@ class CaseEditComponent {
|
|
|
9338
9351
|
}
|
|
9339
9352
|
CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
|
|
9340
9353
|
CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
|
|
9341
|
-
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)); };
|
|
9354
|
+
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)); };
|
|
9342
9355
|
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) {
|
|
9343
9356
|
if (rf & 1) {
|
|
9344
9357
|
i0.ɵɵelement(0, "router-outlet");
|
|
@@ -9348,7 +9361,7 @@ CaseEditComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditC
|
|
|
9348
9361
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
|
|
9349
9362
|
type: Component,
|
|
9350
9363
|
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"] }]
|
|
9351
|
-
}], 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: [{
|
|
9364
|
+
}], 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: [{
|
|
9352
9365
|
type: Input
|
|
9353
9366
|
}], submit: [{
|
|
9354
9367
|
type: Input
|
|
@@ -10000,7 +10013,7 @@ function CaseEditPageComponent_ccd_case_event_completion_11_Template(rf, ctx) {
|
|
|
10000
10013
|
}
|
|
10001
10014
|
}
|
|
10002
10015
|
class CaseEditPageComponent {
|
|
10003
|
-
constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
|
|
10016
|
+
constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService, addressService) {
|
|
10004
10017
|
this.caseEdit = caseEdit;
|
|
10005
10018
|
this.route = route;
|
|
10006
10019
|
this.formValueService = formValueService;
|
|
@@ -10012,6 +10025,7 @@ class CaseEditPageComponent {
|
|
|
10012
10025
|
this.caseEditDataService = caseEditDataService;
|
|
10013
10026
|
this.loadingService = loadingService;
|
|
10014
10027
|
this.validPageListCaseFieldsService = validPageListCaseFieldsService;
|
|
10028
|
+
this.addressService = addressService;
|
|
10015
10029
|
this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
|
|
10016
10030
|
this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
|
|
10017
10031
|
this.formValuesChanged = false;
|
|
@@ -10136,7 +10150,14 @@ class CaseEditPageComponent {
|
|
|
10136
10150
|
}
|
|
10137
10151
|
}
|
|
10138
10152
|
if (fieldElement.hasError('required')) {
|
|
10139
|
-
|
|
10153
|
+
if (casefield.id === 'AddressLine1') {
|
|
10154
|
+
// EUI-1067 - Display more relevant error message to user and correctly navigate to the field
|
|
10155
|
+
this.addressService.setMandatoryError(true);
|
|
10156
|
+
this.caseEditDataService.addFormValidationError({ id: `${path}_${path}`, message: `An address is required` });
|
|
10157
|
+
}
|
|
10158
|
+
else {
|
|
10159
|
+
this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
|
|
10160
|
+
}
|
|
10140
10161
|
fieldElement.markAsDirty();
|
|
10141
10162
|
// For the JudicialUser field type, an error needs to be set on the component so that an error message
|
|
10142
10163
|
// can be displayed at field level
|
|
@@ -10211,6 +10232,7 @@ class CaseEditPageComponent {
|
|
|
10211
10232
|
}
|
|
10212
10233
|
}
|
|
10213
10234
|
if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
|
|
10235
|
+
this.addressService.setMandatoryError(false);
|
|
10214
10236
|
console.log('Case Edit Error', this.caseEdit.error);
|
|
10215
10237
|
if (this.caseEdit.validPageList.findIndex(page => page.id === this.currentPage.id) === -1) {
|
|
10216
10238
|
this.caseEdit.validPageList.push(this.currentPage);
|
|
@@ -10506,7 +10528,7 @@ CaseEditPageComponent.RESUMED_FORM_SAVE = 'RESUMED_FORM_SAVE';
|
|
|
10506
10528
|
CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
|
|
10507
10529
|
CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
|
|
10508
10530
|
CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
|
|
10509
|
-
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)); };
|
|
10531
|
+
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)); };
|
|
10510
10532
|
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) {
|
|
10511
10533
|
if (rf & 1) {
|
|
10512
10534
|
i0.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
|
|
@@ -10545,7 +10567,7 @@ CaseEditPageComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseE
|
|
|
10545
10567
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditPageComponent, [{
|
|
10546
10568
|
type: Component,
|
|
10547
10569
|
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"] }]
|
|
10548
|
-
}], 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);
|
|
10570
|
+
}], 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);
|
|
10549
10571
|
})();
|
|
10550
10572
|
|
|
10551
10573
|
class CallbackErrorsContext {
|
|
@@ -11037,6 +11059,17 @@ class AddressOption {
|
|
|
11037
11059
|
}
|
|
11038
11060
|
}
|
|
11039
11061
|
|
|
11062
|
+
class AddressValidationConstants {
|
|
11063
|
+
}
|
|
11064
|
+
AddressValidationConstants.REGEX_POSTCODE = /^(([A-Za-z]{1,2}\d[A-Za-z0-9]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) *\d[A-Za-z]{2}|BFPO *\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Za-z]{2} *\d{2}|GE *CX|GIR *0A{2}|SAN *TA1)$/;
|
|
11065
|
+
AddressValidationConstants.ɵfac = function AddressValidationConstants_Factory(t) { return new (t || AddressValidationConstants)(); };
|
|
11066
|
+
AddressValidationConstants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AddressValidationConstants, factory: AddressValidationConstants.ɵfac });
|
|
11067
|
+
(function () {
|
|
11068
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddressValidationConstants, [{
|
|
11069
|
+
type: Injectable
|
|
11070
|
+
}], null, null);
|
|
11071
|
+
})();
|
|
11072
|
+
|
|
11040
11073
|
const _c0$U = ["writeComplexFieldComponent"];
|
|
11041
11074
|
function WriteAddressFieldComponent_div_1_div_4_span_5_Template(rf, ctx) {
|
|
11042
11075
|
if (rf & 1) {
|
|
@@ -11046,8 +11079,9 @@ function WriteAddressFieldComponent_div_1_div_4_span_5_Template(rf, ctx) {
|
|
|
11046
11079
|
i0.ɵɵelementEnd();
|
|
11047
11080
|
}
|
|
11048
11081
|
if (rf & 2) {
|
|
11082
|
+
const ctx_r5 = i0.ɵɵnextContext(3);
|
|
11049
11083
|
i0.ɵɵadvance(1);
|
|
11050
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1,
|
|
11084
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r5.errorMessage));
|
|
11051
11085
|
}
|
|
11052
11086
|
}
|
|
11053
11087
|
const _c1$n = function (a0) { return { "form-group-error": a0 }; };
|
|
@@ -11082,7 +11116,20 @@ function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) {
|
|
|
11082
11116
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(9, 11, "Find address"));
|
|
11083
11117
|
}
|
|
11084
11118
|
}
|
|
11085
|
-
function
|
|
11119
|
+
function WriteAddressFieldComponent_div_1_div_5_span_5_Template(rf, ctx) {
|
|
11120
|
+
if (rf & 1) {
|
|
11121
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
11122
|
+
i0.ɵɵtext(1);
|
|
11123
|
+
i0.ɵɵpipe(2, "rpxTranslate");
|
|
11124
|
+
i0.ɵɵelementEnd();
|
|
11125
|
+
}
|
|
11126
|
+
if (rf & 2) {
|
|
11127
|
+
const ctx_r8 = i0.ɵɵnextContext(3);
|
|
11128
|
+
i0.ɵɵadvance(1);
|
|
11129
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r8.errorMessage));
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
function WriteAddressFieldComponent_div_1_div_5_option_7_Template(rf, ctx) {
|
|
11086
11133
|
if (rf & 1) {
|
|
11087
11134
|
i0.ɵɵelementStart(0, "option", 18);
|
|
11088
11135
|
i0.ɵɵtext(1);
|
|
@@ -11090,31 +11137,35 @@ function WriteAddressFieldComponent_div_1_div_5_option_6_Template(rf, ctx) {
|
|
|
11090
11137
|
i0.ɵɵelementEnd();
|
|
11091
11138
|
}
|
|
11092
11139
|
if (rf & 2) {
|
|
11093
|
-
const
|
|
11094
|
-
i0.ɵɵproperty("ngValue",
|
|
11140
|
+
const addressOption_r10 = ctx.$implicit;
|
|
11141
|
+
i0.ɵɵproperty("ngValue", addressOption_r10.value);
|
|
11095
11142
|
i0.ɵɵadvance(1);
|
|
11096
|
-
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2,
|
|
11143
|
+
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, addressOption_r10.description), " ");
|
|
11097
11144
|
}
|
|
11098
11145
|
}
|
|
11099
11146
|
function WriteAddressFieldComponent_div_1_div_5_Template(rf, ctx) {
|
|
11100
11147
|
if (rf & 1) {
|
|
11101
|
-
const
|
|
11148
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
11102
11149
|
i0.ɵɵelementStart(0, "div", 15)(1, "label", 9)(2, "span", 10);
|
|
11103
11150
|
i0.ɵɵtext(3);
|
|
11104
11151
|
i0.ɵɵpipe(4, "rpxTranslate");
|
|
11105
11152
|
i0.ɵɵelementEnd()();
|
|
11106
|
-
i0.ɵɵ
|
|
11107
|
-
i0.ɵɵ
|
|
11108
|
-
i0.ɵɵ
|
|
11153
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_span_5_Template, 3, 3, "span", 11);
|
|
11154
|
+
i0.ɵɵelementStart(6, "select", 16);
|
|
11155
|
+
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()); });
|
|
11156
|
+
i0.ɵɵtemplate(7, WriteAddressFieldComponent_div_1_div_5_option_7_Template, 3, 4, "option", 17);
|
|
11109
11157
|
i0.ɵɵelementEnd()();
|
|
11110
11158
|
}
|
|
11111
11159
|
if (rf & 2) {
|
|
11112
11160
|
const ctx_r3 = i0.ɵɵnextContext(2);
|
|
11161
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1$n, ctx_r3.noAddressSelected));
|
|
11113
11162
|
i0.ɵɵadvance(1);
|
|
11114
11163
|
i0.ɵɵproperty("for", ctx_r3.createElementId("addressList"));
|
|
11115
11164
|
i0.ɵɵadvance(2);
|
|
11116
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4,
|
|
11165
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 7, "Select an address"));
|
|
11117
11166
|
i0.ɵɵadvance(2);
|
|
11167
|
+
i0.ɵɵproperty("ngIf", ctx_r3.noAddressSelected);
|
|
11168
|
+
i0.ɵɵadvance(1);
|
|
11118
11169
|
i0.ɵɵproperty("id", ctx_r3.createElementId("addressList"))("formControl", ctx_r3.addressList);
|
|
11119
11170
|
i0.ɵɵadvance(1);
|
|
11120
11171
|
i0.ɵɵproperty("ngForOf", ctx_r3.addressOptions);
|
|
@@ -11122,9 +11173,9 @@ function WriteAddressFieldComponent_div_1_div_5_Template(rf, ctx) {
|
|
|
11122
11173
|
}
|
|
11123
11174
|
function WriteAddressFieldComponent_div_1_a_6_Template(rf, ctx) {
|
|
11124
11175
|
if (rf & 1) {
|
|
11125
|
-
const
|
|
11176
|
+
const _r14 = i0.ɵɵgetCurrentView();
|
|
11126
11177
|
i0.ɵɵelementStart(0, "a", 19);
|
|
11127
|
-
i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(
|
|
11178
|
+
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()); });
|
|
11128
11179
|
i0.ɵɵtext(1);
|
|
11129
11180
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
11130
11181
|
i0.ɵɵelementEnd();
|
|
@@ -11141,7 +11192,7 @@ function WriteAddressFieldComponent_div_1_Template(rf, ctx) {
|
|
|
11141
11192
|
i0.ɵɵpipe(3, "ccdFieldLabel");
|
|
11142
11193
|
i0.ɵɵelementEnd();
|
|
11143
11194
|
i0.ɵɵtemplate(4, WriteAddressFieldComponent_div_1_div_4_Template, 10, 17, "div", 5);
|
|
11144
|
-
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template,
|
|
11195
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template, 8, 11, "div", 6);
|
|
11145
11196
|
i0.ɵɵtemplate(6, WriteAddressFieldComponent_div_1_a_6_Template, 3, 3, "a", 7);
|
|
11146
11197
|
i0.ɵɵelementEnd();
|
|
11147
11198
|
}
|
|
@@ -11162,19 +11213,30 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11162
11213
|
super();
|
|
11163
11214
|
this.isCompoundPipe = isCompoundPipe;
|
|
11164
11215
|
this.addressFormGroup = new FormGroup({});
|
|
11216
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
11165
11217
|
this.missingPostcode = false;
|
|
11218
|
+
this.noAddressSelected = false;
|
|
11166
11219
|
this.addressesService = addressesService;
|
|
11167
11220
|
}
|
|
11168
11221
|
ngOnInit() {
|
|
11169
11222
|
if (!this.isComplexWithHiddenFields()) {
|
|
11170
|
-
this.postcode = new FormControl('');
|
|
11171
|
-
this.
|
|
11223
|
+
this.postcode = new FormControl('', [Validators.required]);
|
|
11224
|
+
this.formGroup.addControl('postcode', this.postcode);
|
|
11172
11225
|
this.addressList = new FormControl('');
|
|
11173
|
-
this.
|
|
11226
|
+
this.formGroup.addControl('address', this.addressList);
|
|
11174
11227
|
}
|
|
11228
|
+
this.addressesService.getMandatoryError().subscribe((value) => {
|
|
11229
|
+
this.updateErrorsOnContinue(value);
|
|
11230
|
+
});
|
|
11175
11231
|
}
|
|
11176
11232
|
findAddress() {
|
|
11233
|
+
this.noAddressSelected = false;
|
|
11177
11234
|
if (!this.postcode.value) {
|
|
11235
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
11236
|
+
this.missingPostcode = true;
|
|
11237
|
+
}
|
|
11238
|
+
else if (!this.postcode.value.trim().match(AddressValidationConstants.REGEX_POSTCODE)) {
|
|
11239
|
+
this.errorMessage = WriteAddressFieldComponent.INVALID_ERROR_MESSAGE;
|
|
11178
11240
|
this.missingPostcode = true;
|
|
11179
11241
|
}
|
|
11180
11242
|
else {
|
|
@@ -11203,6 +11265,8 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11203
11265
|
blankAddress() {
|
|
11204
11266
|
this.caseField.value = new AddressModel();
|
|
11205
11267
|
this.setFormValue();
|
|
11268
|
+
this.missingPostcode = false;
|
|
11269
|
+
this.noAddressSelected = false;
|
|
11206
11270
|
}
|
|
11207
11271
|
isComplexWithHiddenFields() {
|
|
11208
11272
|
if (this.caseField.isComplex() && this.caseField.field_type.complex_fields
|
|
@@ -11234,6 +11298,7 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11234
11298
|
addressSelected() {
|
|
11235
11299
|
this.caseField.value = this.addressList.value;
|
|
11236
11300
|
this.setFormValue();
|
|
11301
|
+
this.noAddressSelected = false;
|
|
11237
11302
|
}
|
|
11238
11303
|
ngOnChanges(changes) {
|
|
11239
11304
|
super.ngOnChanges(changes);
|
|
@@ -11254,7 +11319,14 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11254
11319
|
this.writeComplexFieldComponent.complexGroup.setValue(this.caseField.value);
|
|
11255
11320
|
}
|
|
11256
11321
|
}
|
|
11322
|
+
updateErrorsOnContinue(value) {
|
|
11323
|
+
this.missingPostcode = value && !this.shouldShowDetailFields() && !this.addressOptions;
|
|
11324
|
+
this.noAddressSelected = value && !this.shouldShowDetailFields() && !!this.addressOptions;
|
|
11325
|
+
this.errorMessage = this.noAddressSelected ? 'Select an address' : this.errorMessage;
|
|
11326
|
+
}
|
|
11257
11327
|
}
|
|
11328
|
+
WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE = 'Enter a Postcode';
|
|
11329
|
+
WriteAddressFieldComponent.INVALID_ERROR_MESSAGE = 'Enter a valid Postcode';
|
|
11258
11330
|
WriteAddressFieldComponent.ɵfac = function WriteAddressFieldComponent_Factory(t) { return new (t || WriteAddressFieldComponent)(i0.ɵɵdirectiveInject(AddressesService), i0.ɵɵdirectiveInject(IsCompoundPipe)); };
|
|
11259
11331
|
WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteAddressFieldComponent, selectors: [["ccd-write-address-field"]], viewQuery: function WriteAddressFieldComponent_Query(rf, ctx) {
|
|
11260
11332
|
if (rf & 1) {
|
|
@@ -11266,7 +11338,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11266
11338
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
|
|
11267
11339
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.focusElementDirectives = _t);
|
|
11268
11340
|
}
|
|
11269
|
-
}, 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) {
|
|
11341
|
+
}, 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) {
|
|
11270
11342
|
if (rf & 1) {
|
|
11271
11343
|
i0.ɵɵelementStart(0, "div", 0);
|
|
11272
11344
|
i0.ɵɵtemplate(1, WriteAddressFieldComponent_div_1_Template, 7, 6, "div", 1);
|
|
@@ -11284,7 +11356,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11284
11356
|
(function () {
|
|
11285
11357
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteAddressFieldComponent, [{
|
|
11286
11358
|
type: Component,
|
|
11287
|
-
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\">{{
|
|
11359
|
+
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"] }]
|
|
11288
11360
|
}], function () { return [{ type: AddressesService }, { type: IsCompoundPipe }]; }, { writeComplexFieldComponent: [{
|
|
11289
11361
|
type: ViewChild,
|
|
11290
11362
|
args: ['writeComplexFieldComponent', { static: false }]
|
|
@@ -32629,7 +32701,7 @@ function CaseEventTriggerComponent_div_0_Template(rf, ctx) {
|
|
|
32629
32701
|
}
|
|
32630
32702
|
}
|
|
32631
32703
|
class CaseEventTriggerComponent {
|
|
32632
|
-
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService) {
|
|
32704
|
+
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService, sessionStorageService) {
|
|
32633
32705
|
this.ngZone = ngZone;
|
|
32634
32706
|
this.casesService = casesService;
|
|
32635
32707
|
this.caseNotifier = caseNotifier;
|
|
@@ -32638,6 +32710,7 @@ class CaseEventTriggerComponent {
|
|
|
32638
32710
|
this.route = route;
|
|
32639
32711
|
this.caseReferencePipe = caseReferencePipe;
|
|
32640
32712
|
this.activityPollingService = activityPollingService;
|
|
32713
|
+
this.sessionStorageService = sessionStorageService;
|
|
32641
32714
|
this.BANNER = DisplayMode.BANNER;
|
|
32642
32715
|
}
|
|
32643
32716
|
ngOnInit() {
|
|
@@ -32687,21 +32760,30 @@ class CaseEventTriggerComponent {
|
|
|
32687
32760
|
}
|
|
32688
32761
|
submitted(event) {
|
|
32689
32762
|
const eventStatus = event['status'];
|
|
32763
|
+
const taskCompletionFailed = this.sessionStorageService.getItem('taskCompletionError') === 'true';
|
|
32690
32764
|
this.router
|
|
32691
32765
|
.navigate([this.parentUrl])
|
|
32692
32766
|
.then(() => {
|
|
32693
32767
|
const caseReference = this.caseReferencePipe.transform(this.caseDetails.case_id.toString());
|
|
32694
32768
|
const replacements = { CASEREFERENCE: caseReference, NAME: this.eventTrigger.name };
|
|
32695
|
-
|
|
32769
|
+
this.alertService.setPreserveAlerts(true);
|
|
32770
|
+
if (taskCompletionFailed) {
|
|
32771
|
+
// if task still present in session storage, we know that the task has not been correctly completed
|
|
32772
|
+
this.alertService.warning({
|
|
32773
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + '. ' + Constants.TASK_COMPLETION_ERROR,
|
|
32774
|
+
replacements
|
|
32775
|
+
});
|
|
32776
|
+
this.sessionStorageService.removeItem('taskCompletionError');
|
|
32777
|
+
}
|
|
32778
|
+
else if (EventStatusService.isIncomplete(eventStatus)) {
|
|
32696
32779
|
this.alertService.warning({
|
|
32697
|
-
phrase:
|
|
32698
|
-
but the callback service cannot be completed`,
|
|
32780
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE,
|
|
32699
32781
|
replacements
|
|
32700
32782
|
});
|
|
32701
32783
|
}
|
|
32702
32784
|
else {
|
|
32703
32785
|
this.alertService.success({
|
|
32704
|
-
phrase:
|
|
32786
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE,
|
|
32705
32787
|
replacements,
|
|
32706
32788
|
preserve: true
|
|
32707
32789
|
});
|
|
@@ -32720,7 +32802,9 @@ class CaseEventTriggerComponent {
|
|
|
32720
32802
|
return !!(this.eventTrigger && this.caseDetails);
|
|
32721
32803
|
}
|
|
32722
32804
|
}
|
|
32723
|
-
CaseEventTriggerComponent
|
|
32805
|
+
CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE = `Case #%CASEREFERENCE% has been updated with event: %NAME%`;
|
|
32806
|
+
CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE = ' but the callback service cannot be completed';
|
|
32807
|
+
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)); };
|
|
32724
32808
|
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) {
|
|
32725
32809
|
if (rf & 1) {
|
|
32726
32810
|
i0.ɵɵtemplate(0, CaseEventTriggerComponent_div_0_Template, 3, 6, "div", 0);
|
|
@@ -32733,7 +32817,7 @@ CaseEventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: C
|
|
|
32733
32817
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventTriggerComponent, [{
|
|
32734
32818
|
type: Component,
|
|
32735
32819
|
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" }]
|
|
32736
|
-
}], function () { return [{ type: i0.NgZone }, { type: CasesService }, { type: CaseNotifier }, { type: i1$1.Router }, { type: AlertService }, { type: i1$1.ActivatedRoute }, { type: CaseReferencePipe }, { type: ActivityPollingService }]; }, null);
|
|
32820
|
+
}], 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);
|
|
32737
32821
|
})();
|
|
32738
32822
|
|
|
32739
32823
|
function CaseViewComponent_div_0_Template(rf, ctx) {
|