@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,
|
|
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,15 @@ class AddressOption {
|
|
|
10600
10622
|
}
|
|
10601
10623
|
}
|
|
10602
10624
|
|
|
10625
|
+
class AddressValidationConstants {
|
|
10626
|
+
}
|
|
10627
|
+
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)$/;
|
|
10628
|
+
AddressValidationConstants.ɵfac = function AddressValidationConstants_Factory(t) { return new (t || AddressValidationConstants)(); };
|
|
10629
|
+
AddressValidationConstants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AddressValidationConstants, factory: AddressValidationConstants.ɵfac });
|
|
10630
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddressValidationConstants, [{
|
|
10631
|
+
type: Injectable
|
|
10632
|
+
}], null, null); })();
|
|
10633
|
+
|
|
10603
10634
|
class FieldsFilterPipe {
|
|
10604
10635
|
/**
|
|
10605
10636
|
* Complex type should have at least on simple field descendant with a value.
|
|
@@ -10866,8 +10897,9 @@ function WriteAddressFieldComponent_div_1_div_4_span_5_Template(rf, ctx) { if (r
|
|
|
10866
10897
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10867
10898
|
i0.ɵɵelementEnd();
|
|
10868
10899
|
} if (rf & 2) {
|
|
10900
|
+
const ctx_r5 = i0.ɵɵnextContext(3);
|
|
10869
10901
|
i0.ɵɵadvance(1);
|
|
10870
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1,
|
|
10902
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r5.errorMessage));
|
|
10871
10903
|
} }
|
|
10872
10904
|
const _c1$n = function (a0) { return { "form-group-error": a0 }; };
|
|
10873
10905
|
const _c2$2 = function (a0) { return { "govuk-input--error": a0 }; };
|
|
@@ -10898,42 +10930,56 @@ function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) { if (rf & 1)
|
|
|
10898
10930
|
i0.ɵɵadvance(2);
|
|
10899
10931
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(9, 11, "Find address"));
|
|
10900
10932
|
} }
|
|
10901
|
-
function
|
|
10933
|
+
function WriteAddressFieldComponent_div_1_div_5_span_5_Template(rf, ctx) { if (rf & 1) {
|
|
10934
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
10935
|
+
i0.ɵɵtext(1);
|
|
10936
|
+
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10937
|
+
i0.ɵɵelementEnd();
|
|
10938
|
+
} if (rf & 2) {
|
|
10939
|
+
const ctx_r8 = i0.ɵɵnextContext(3);
|
|
10940
|
+
i0.ɵɵadvance(1);
|
|
10941
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r8.errorMessage));
|
|
10942
|
+
} }
|
|
10943
|
+
function WriteAddressFieldComponent_div_1_div_5_option_7_Template(rf, ctx) { if (rf & 1) {
|
|
10902
10944
|
i0.ɵɵelementStart(0, "option", 18);
|
|
10903
10945
|
i0.ɵɵtext(1);
|
|
10904
10946
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10905
10947
|
i0.ɵɵelementEnd();
|
|
10906
10948
|
} if (rf & 2) {
|
|
10907
|
-
const
|
|
10908
|
-
i0.ɵɵproperty("ngValue",
|
|
10949
|
+
const addressOption_r10 = ctx.$implicit;
|
|
10950
|
+
i0.ɵɵproperty("ngValue", addressOption_r10.value);
|
|
10909
10951
|
i0.ɵɵadvance(1);
|
|
10910
|
-
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2,
|
|
10952
|
+
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, addressOption_r10.description), " ");
|
|
10911
10953
|
} }
|
|
10912
10954
|
function WriteAddressFieldComponent_div_1_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
10913
|
-
const
|
|
10955
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
10914
10956
|
i0.ɵɵelementStart(0, "div", 15)(1, "label", 9)(2, "span", 10);
|
|
10915
10957
|
i0.ɵɵtext(3);
|
|
10916
10958
|
i0.ɵɵpipe(4, "rpxTranslate");
|
|
10917
10959
|
i0.ɵɵelementEnd()();
|
|
10918
|
-
i0.ɵɵ
|
|
10919
|
-
i0.ɵɵ
|
|
10920
|
-
i0.ɵɵ
|
|
10960
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_span_5_Template, 3, 3, "span", 11);
|
|
10961
|
+
i0.ɵɵelementStart(6, "select", 16);
|
|
10962
|
+
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()); });
|
|
10963
|
+
i0.ɵɵtemplate(7, WriteAddressFieldComponent_div_1_div_5_option_7_Template, 3, 4, "option", 17);
|
|
10921
10964
|
i0.ɵɵelementEnd()();
|
|
10922
10965
|
} if (rf & 2) {
|
|
10923
10966
|
const ctx_r3 = i0.ɵɵnextContext(2);
|
|
10967
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1$n, ctx_r3.noAddressSelected));
|
|
10924
10968
|
i0.ɵɵadvance(1);
|
|
10925
10969
|
i0.ɵɵproperty("for", ctx_r3.createElementId("addressList"));
|
|
10926
10970
|
i0.ɵɵadvance(2);
|
|
10927
|
-
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4,
|
|
10971
|
+
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 7, "Select an address"));
|
|
10928
10972
|
i0.ɵɵadvance(2);
|
|
10973
|
+
i0.ɵɵproperty("ngIf", ctx_r3.noAddressSelected);
|
|
10974
|
+
i0.ɵɵadvance(1);
|
|
10929
10975
|
i0.ɵɵproperty("id", ctx_r3.createElementId("addressList"))("formControl", ctx_r3.addressList);
|
|
10930
10976
|
i0.ɵɵadvance(1);
|
|
10931
10977
|
i0.ɵɵproperty("ngForOf", ctx_r3.addressOptions);
|
|
10932
10978
|
} }
|
|
10933
10979
|
function WriteAddressFieldComponent_div_1_a_6_Template(rf, ctx) { if (rf & 1) {
|
|
10934
|
-
const
|
|
10980
|
+
const _r14 = i0.ɵɵgetCurrentView();
|
|
10935
10981
|
i0.ɵɵelementStart(0, "a", 19);
|
|
10936
|
-
i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(
|
|
10982
|
+
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
10983
|
i0.ɵɵtext(1);
|
|
10938
10984
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
10939
10985
|
i0.ɵɵelementEnd();
|
|
@@ -10947,7 +10993,7 @@ function WriteAddressFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
10947
10993
|
i0.ɵɵpipe(3, "ccdFieldLabel");
|
|
10948
10994
|
i0.ɵɵelementEnd();
|
|
10949
10995
|
i0.ɵɵtemplate(4, WriteAddressFieldComponent_div_1_div_4_Template, 10, 17, "div", 5);
|
|
10950
|
-
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template,
|
|
10996
|
+
i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template, 8, 11, "div", 6);
|
|
10951
10997
|
i0.ɵɵtemplate(6, WriteAddressFieldComponent_div_1_a_6_Template, 3, 3, "a", 7);
|
|
10952
10998
|
i0.ɵɵelementEnd();
|
|
10953
10999
|
} if (rf & 2) {
|
|
@@ -10966,19 +11012,30 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
10966
11012
|
super();
|
|
10967
11013
|
this.isCompoundPipe = isCompoundPipe;
|
|
10968
11014
|
this.addressFormGroup = new FormGroup({});
|
|
11015
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
10969
11016
|
this.missingPostcode = false;
|
|
11017
|
+
this.noAddressSelected = false;
|
|
10970
11018
|
this.addressesService = addressesService;
|
|
10971
11019
|
}
|
|
10972
11020
|
ngOnInit() {
|
|
10973
11021
|
if (!this.isComplexWithHiddenFields()) {
|
|
10974
|
-
this.postcode = new FormControl('');
|
|
10975
|
-
this.
|
|
11022
|
+
this.postcode = new FormControl('', [Validators.required]);
|
|
11023
|
+
this.formGroup.addControl('postcode', this.postcode);
|
|
10976
11024
|
this.addressList = new FormControl('');
|
|
10977
|
-
this.
|
|
11025
|
+
this.formGroup.addControl('address', this.addressList);
|
|
10978
11026
|
}
|
|
11027
|
+
this.addressesService.getMandatoryError().subscribe((value) => {
|
|
11028
|
+
this.updateErrorsOnContinue(value);
|
|
11029
|
+
});
|
|
10979
11030
|
}
|
|
10980
11031
|
findAddress() {
|
|
11032
|
+
this.noAddressSelected = false;
|
|
10981
11033
|
if (!this.postcode.value) {
|
|
11034
|
+
this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
|
|
11035
|
+
this.missingPostcode = true;
|
|
11036
|
+
}
|
|
11037
|
+
else if (!this.postcode.value.trim().match(AddressValidationConstants.REGEX_POSTCODE)) {
|
|
11038
|
+
this.errorMessage = WriteAddressFieldComponent.INVALID_ERROR_MESSAGE;
|
|
10982
11039
|
this.missingPostcode = true;
|
|
10983
11040
|
}
|
|
10984
11041
|
else {
|
|
@@ -11007,6 +11064,8 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11007
11064
|
blankAddress() {
|
|
11008
11065
|
this.caseField.value = new AddressModel();
|
|
11009
11066
|
this.setFormValue();
|
|
11067
|
+
this.missingPostcode = false;
|
|
11068
|
+
this.noAddressSelected = false;
|
|
11010
11069
|
}
|
|
11011
11070
|
isComplexWithHiddenFields() {
|
|
11012
11071
|
if (this.caseField.isComplex() && this.caseField.field_type.complex_fields
|
|
@@ -11038,6 +11097,7 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11038
11097
|
addressSelected() {
|
|
11039
11098
|
this.caseField.value = this.addressList.value;
|
|
11040
11099
|
this.setFormValue();
|
|
11100
|
+
this.noAddressSelected = false;
|
|
11041
11101
|
}
|
|
11042
11102
|
ngOnChanges(changes) {
|
|
11043
11103
|
super.ngOnChanges(changes);
|
|
@@ -11058,7 +11118,14 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11058
11118
|
this.writeComplexFieldComponent.complexGroup.setValue(this.caseField.value);
|
|
11059
11119
|
}
|
|
11060
11120
|
}
|
|
11121
|
+
updateErrorsOnContinue(value) {
|
|
11122
|
+
this.missingPostcode = value && !this.shouldShowDetailFields() && !this.addressOptions;
|
|
11123
|
+
this.noAddressSelected = value && !this.shouldShowDetailFields() && !!this.addressOptions;
|
|
11124
|
+
this.errorMessage = this.noAddressSelected ? 'Select an address' : this.errorMessage;
|
|
11125
|
+
}
|
|
11061
11126
|
}
|
|
11127
|
+
WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE = 'Enter a Postcode';
|
|
11128
|
+
WriteAddressFieldComponent.INVALID_ERROR_MESSAGE = 'Enter a valid Postcode';
|
|
11062
11129
|
WriteAddressFieldComponent.ɵfac = function WriteAddressFieldComponent_Factory(t) { return new (t || WriteAddressFieldComponent)(i0.ɵɵdirectiveInject(AddressesService), i0.ɵɵdirectiveInject(IsCompoundPipe)); };
|
|
11063
11130
|
WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteAddressFieldComponent, selectors: [["ccd-write-address-field"]], viewQuery: function WriteAddressFieldComponent_Query(rf, ctx) { if (rf & 1) {
|
|
11064
11131
|
i0.ɵɵviewQuery(_c0$U, 5);
|
|
@@ -11067,7 +11134,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11067
11134
|
let _t;
|
|
11068
11135
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
|
|
11069
11136
|
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) {
|
|
11137
|
+
} }, 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
11138
|
i0.ɵɵelementStart(0, "div", 0);
|
|
11072
11139
|
i0.ɵɵtemplate(1, WriteAddressFieldComponent_div_1_Template, 7, 6, "div", 1);
|
|
11073
11140
|
i0.ɵɵelement(2, "ccd-write-complex-type-field", 2, 3);
|
|
@@ -11081,7 +11148,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
|
|
|
11081
11148
|
} }, styles: [".manual-link[_ngcontent-%COMP%]{cursor:pointer;display:block;text-decoration:underline}"] });
|
|
11082
11149
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteAddressFieldComponent, [{
|
|
11083
11150
|
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\">{{
|
|
11151
|
+
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
11152
|
}], function () { return [{ type: AddressesService }, { type: IsCompoundPipe }]; }, { writeComplexFieldComponent: [{
|
|
11086
11153
|
type: ViewChild,
|
|
11087
11154
|
args: ['writeComplexFieldComponent', { static: false }]
|
|
@@ -30099,7 +30166,7 @@ function CaseEventTriggerComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
30099
30166
|
i0.ɵɵproperty("caseDetails", ctx_r0.caseDetails)("submit", ctx_r0.submit())("validate", ctx_r0.validate())("eventTrigger", ctx_r0.eventTrigger);
|
|
30100
30167
|
} }
|
|
30101
30168
|
class CaseEventTriggerComponent {
|
|
30102
|
-
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService) {
|
|
30169
|
+
constructor(ngZone, casesService, caseNotifier, router, alertService, route, caseReferencePipe, activityPollingService, sessionStorageService) {
|
|
30103
30170
|
this.ngZone = ngZone;
|
|
30104
30171
|
this.casesService = casesService;
|
|
30105
30172
|
this.caseNotifier = caseNotifier;
|
|
@@ -30108,6 +30175,7 @@ class CaseEventTriggerComponent {
|
|
|
30108
30175
|
this.route = route;
|
|
30109
30176
|
this.caseReferencePipe = caseReferencePipe;
|
|
30110
30177
|
this.activityPollingService = activityPollingService;
|
|
30178
|
+
this.sessionStorageService = sessionStorageService;
|
|
30111
30179
|
this.BANNER = DisplayMode.BANNER;
|
|
30112
30180
|
}
|
|
30113
30181
|
ngOnInit() {
|
|
@@ -30156,21 +30224,30 @@ class CaseEventTriggerComponent {
|
|
|
30156
30224
|
}
|
|
30157
30225
|
submitted(event) {
|
|
30158
30226
|
const eventStatus = event['status'];
|
|
30227
|
+
const taskCompletionFailed = this.sessionStorageService.getItem('taskCompletionError') === 'true';
|
|
30159
30228
|
this.router
|
|
30160
30229
|
.navigate([this.parentUrl])
|
|
30161
30230
|
.then(() => {
|
|
30162
30231
|
const caseReference = this.caseReferencePipe.transform(this.caseDetails.case_id.toString());
|
|
30163
30232
|
const replacements = { CASEREFERENCE: caseReference, NAME: this.eventTrigger.name };
|
|
30164
|
-
|
|
30233
|
+
this.alertService.setPreserveAlerts(true);
|
|
30234
|
+
if (taskCompletionFailed) {
|
|
30235
|
+
// if task still present in session storage, we know that the task has not been correctly completed
|
|
30236
|
+
this.alertService.warning({
|
|
30237
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + '. ' + Constants.TASK_COMPLETION_ERROR,
|
|
30238
|
+
replacements
|
|
30239
|
+
});
|
|
30240
|
+
this.sessionStorageService.removeItem('taskCompletionError');
|
|
30241
|
+
}
|
|
30242
|
+
else if (EventStatusService.isIncomplete(eventStatus)) {
|
|
30165
30243
|
this.alertService.warning({
|
|
30166
|
-
phrase:
|
|
30167
|
-
but the callback service cannot be completed`,
|
|
30244
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE + CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE,
|
|
30168
30245
|
replacements
|
|
30169
30246
|
});
|
|
30170
30247
|
}
|
|
30171
30248
|
else {
|
|
30172
30249
|
this.alertService.success({
|
|
30173
|
-
phrase:
|
|
30250
|
+
phrase: CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE,
|
|
30174
30251
|
replacements,
|
|
30175
30252
|
preserve: true
|
|
30176
30253
|
});
|
|
@@ -30189,7 +30266,9 @@ class CaseEventTriggerComponent {
|
|
|
30189
30266
|
return !!(this.eventTrigger && this.caseDetails);
|
|
30190
30267
|
}
|
|
30191
30268
|
}
|
|
30192
|
-
CaseEventTriggerComponent
|
|
30269
|
+
CaseEventTriggerComponent.EVENT_COMPLETION_MESSAGE = `Case #%CASEREFERENCE% has been updated with event: %NAME%`;
|
|
30270
|
+
CaseEventTriggerComponent.CALLBACK_FAILED_MESSAGE = ' but the callback service cannot be completed';
|
|
30271
|
+
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
30272
|
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
30273
|
i0.ɵɵtemplate(0, CaseEventTriggerComponent_div_0_Template, 3, 6, "div", 0);
|
|
30195
30274
|
} if (rf & 2) {
|
|
@@ -30198,7 +30277,7 @@ CaseEventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: C
|
|
|
30198
30277
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEventTriggerComponent, [{
|
|
30199
30278
|
type: Component,
|
|
30200
30279
|
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); })();
|
|
30280
|
+
}], 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
30281
|
|
|
30203
30282
|
function CaseViewComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
30204
30283
|
i0.ɵɵelementStart(0, "div");
|