@hmcts/rpx-xui-common-lib 1.6.1-adding-location-filter-bugfix → 1.6.1-all-work-filter
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/bundles/hmcts-rpx-xui-common-lib.umd.js +607 -426
- package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/components/find-location/find-location.component.js +98 -44
- package/esm2015/lib/components/find-person/find-person.component.js +59 -24
- package/esm2015/lib/components/generic-filter/generic-filter-utils.js +2 -2
- package/esm2015/lib/components/generic-filter/generic-filter.component.js +49 -42
- package/esm2015/lib/components/search-location/search-location.component.js +53 -67
- package/esm2015/lib/exui-common-lib.module.js +4 -3
- package/esm2015/lib/gov-ui/models/isession-storage.interface.js +24 -0
- package/esm2015/lib/gov-ui/util/session-storage/session-storage-utils.js +58 -0
- package/esm2015/lib/models/filter.model.js +9 -1
- package/esm2015/lib/models/person.model.js +11 -1
- package/esm2015/lib/models/search-options.model.js +4 -2
- package/esm2015/lib/services/find-person/find-person.service.js +77 -24
- package/esm5/lib/components/find-location/find-location.component.js +122 -64
- package/esm5/lib/components/find-person/find-person.component.js +59 -25
- package/esm5/lib/components/generic-filter/generic-filter-utils.js +2 -2
- package/esm5/lib/components/generic-filter/generic-filter.component.js +98 -71
- package/esm5/lib/components/search-location/search-location.component.js +59 -75
- package/esm5/lib/exui-common-lib.module.js +4 -3
- package/esm5/lib/gov-ui/models/isession-storage.interface.js +24 -0
- package/esm5/lib/gov-ui/util/session-storage/session-storage-utils.js +58 -0
- package/esm5/lib/models/filter.model.js +9 -1
- package/esm5/lib/models/person.model.js +11 -1
- package/esm5/lib/models/search-options.model.js +4 -2
- package/esm5/lib/services/find-person/find-person.service.js +83 -24
- package/fesm2015/hmcts-rpx-xui-common-lib.js +425 -268
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +532 -348
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
- package/lib/components/find-location/find-location.component.d.ts +11 -6
- package/lib/components/find-person/find-person.component.d.ts +10 -8
- package/lib/components/generic-filter/generic-filter-utils.d.ts +2 -2
- package/lib/components/generic-filter/generic-filter.component.d.ts +2 -3
- package/lib/components/search-location/search-location.component.d.ts +9 -9
- package/lib/gov-ui/models/isession-storage.interface.d.ts +4 -0
- package/lib/gov-ui/util/session-storage/session-storage-utils.d.ts +6 -0
- package/lib/models/filter.model.d.ts +4 -0
- package/lib/models/person.model.d.ts +4 -0
- package/lib/models/search-options.model.d.ts +2 -1
- package/lib/services/find-person/find-person.service.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MatTabsModule } from '@angular/material';
|
|
1
|
+
import { MatInputModule, MatTabsModule } from '@angular/material';
|
|
2
2
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
3
3
|
import { HttpClient } from '@angular/common/http';
|
|
4
|
-
import { FormBuilder, FormControl, FormGroup, Validators,
|
|
4
|
+
import { FormArray, FormBuilder, FormControl, FormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import { initialize } from 'launchdarkly-js-client-sdk';
|
|
6
6
|
import { formatDate, DOCUMENT, CommonModule } from '@angular/common';
|
|
7
7
|
import { Title } from '@angular/platform-browser';
|
|
@@ -10,7 +10,7 @@ import { Keepalive } from '@ng-idle/keepalive';
|
|
|
10
10
|
import { RouterModule, Router, NavigationEnd } from '@angular/router';
|
|
11
11
|
import { Component, EventEmitter, Input, Output, ViewEncapsulation, Injectable, Directive, TemplateRef, ViewContainerRef, ElementRef, Inject, ViewChild, ChangeDetectorRef, InjectionToken, ChangeDetectionStrategy, defineInjectable, inject, NgModule } from '@angular/core';
|
|
12
12
|
import { BehaviorSubject, of, zip, combineLatest, Subject } from 'rxjs';
|
|
13
|
-
import { distinctUntilChanged, map, debounceTime, filter, mergeMap, tap, startWith, switchMap, delay } from 'rxjs/operators';
|
|
13
|
+
import { distinctUntilChanged, map, debounceTime, filter, mergeMap, tap, catchError, startWith, switchMap, delay } from 'rxjs/operators';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @fileoverview added by tsickle
|
|
@@ -601,7 +601,7 @@ function maxSelectedValidator(max) {
|
|
|
601
601
|
* @param {?} values
|
|
602
602
|
* @return {?}
|
|
603
603
|
*/
|
|
604
|
-
function
|
|
604
|
+
function getValues(options, values) {
|
|
605
605
|
return options.reduce((/**
|
|
606
606
|
* @param {?} acc
|
|
607
607
|
* @param {?} option
|
|
@@ -807,41 +807,12 @@ class GenericFilterComponent {
|
|
|
807
807
|
* @param {?} form
|
|
808
808
|
* @return {?}
|
|
809
809
|
*/
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
* @return {?}
|
|
816
|
-
*/
|
|
817
|
-
(f) => f.name === field.findPersonField));
|
|
818
|
-
if (currentField) {
|
|
819
|
-
currentField.domain = form.get(field.name).value;
|
|
810
|
+
fieldChanged(field, form) {
|
|
811
|
+
// TODO - Do similar with jurisdiction/service for caseworkers by services
|
|
812
|
+
if (field.changeResetFields && field.changeResetFields.length) {
|
|
813
|
+
for (const resetField of field.changeResetFields) {
|
|
814
|
+
this.resetField(resetField, form);
|
|
820
815
|
}
|
|
821
|
-
this.removePersonField(field);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* @param {?} field
|
|
826
|
-
* @return {?}
|
|
827
|
-
*/
|
|
828
|
-
radiosChanged(field) {
|
|
829
|
-
if (field.findPersonField) {
|
|
830
|
-
this.form.get('findPersonControl').setValue(null);
|
|
831
|
-
this.removePersonField(field);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* @param {?} field
|
|
836
|
-
* @return {?}
|
|
837
|
-
*/
|
|
838
|
-
removePersonField(field) {
|
|
839
|
-
if (this.form.get(field.findPersonField)) {
|
|
840
|
-
this.form.get(field.findPersonField).get('domain').setValue(null);
|
|
841
|
-
this.form.get(field.findPersonField).get('email').setValue(null);
|
|
842
|
-
this.form.get(field.findPersonField).get('id').setValue(null);
|
|
843
|
-
this.form.get(field.findPersonField).get('name').setValue(null);
|
|
844
|
-
this.form.get(field.findPersonField).get('knownAs').setValue(null);
|
|
845
816
|
}
|
|
846
817
|
}
|
|
847
818
|
/**
|
|
@@ -856,6 +827,7 @@ class GenericFilterComponent {
|
|
|
856
827
|
const settings = Object.assign({}, this.settings, { reset: true });
|
|
857
828
|
this.filterService.persist(settings, this.config.persistence);
|
|
858
829
|
this.filterService.givenErrors.next(null);
|
|
830
|
+
this.submitted = false;
|
|
859
831
|
}
|
|
860
832
|
/**
|
|
861
833
|
* @param {?} values
|
|
@@ -949,6 +921,39 @@ class GenericFilterComponent {
|
|
|
949
921
|
}
|
|
950
922
|
}));
|
|
951
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* @private
|
|
926
|
+
* @param {?} resetField
|
|
927
|
+
* @param {?} form
|
|
928
|
+
* @return {?}
|
|
929
|
+
*/
|
|
930
|
+
resetField(resetField, form) {
|
|
931
|
+
/** @type {?} */
|
|
932
|
+
const control = form.get(resetField);
|
|
933
|
+
/** @type {?} */
|
|
934
|
+
const defaultValue = this.config.cancelSetting.fields.find((/**
|
|
935
|
+
* @param {?} f
|
|
936
|
+
* @return {?}
|
|
937
|
+
*/
|
|
938
|
+
(f) => f.name === resetField));
|
|
939
|
+
if (control instanceof FormArray) {
|
|
940
|
+
for (let i = 0; i < control.length; i++) {
|
|
941
|
+
control.removeAt(i);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
else if (control instanceof FormGroup) {
|
|
945
|
+
/** @type {?} */
|
|
946
|
+
const keys = Object.keys(control.value);
|
|
947
|
+
for (const key of keys) {
|
|
948
|
+
this.resetField(key, control);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
else if (control instanceof FormControl) {
|
|
952
|
+
/** @type {?} */
|
|
953
|
+
const value = defaultValue && defaultValue.value && defaultValue.value.length ? defaultValue.value[0] : null;
|
|
954
|
+
control.setValue(value);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
952
957
|
/**
|
|
953
958
|
* @private
|
|
954
959
|
* @param {?} filter
|
|
@@ -1043,7 +1048,7 @@ class GenericFilterComponent {
|
|
|
1043
1048
|
}
|
|
1044
1049
|
// if field updates find person component set the initial domain
|
|
1045
1050
|
if (field.findPersonField) {
|
|
1046
|
-
this.
|
|
1051
|
+
this.fieldChanged(field, this.form);
|
|
1047
1052
|
}
|
|
1048
1053
|
}
|
|
1049
1054
|
}
|
|
@@ -1101,8 +1106,10 @@ class GenericFilterComponent {
|
|
|
1101
1106
|
* @return {?}
|
|
1102
1107
|
*/
|
|
1103
1108
|
(f) => f.name === field.name));
|
|
1104
|
-
|
|
1105
|
-
|
|
1109
|
+
if (defaultValues) {
|
|
1110
|
+
for (const defaultValue of defaultValues.value) {
|
|
1111
|
+
formArray.push(new FormControl(defaultValue));
|
|
1112
|
+
}
|
|
1106
1113
|
}
|
|
1107
1114
|
}
|
|
1108
1115
|
return formArray;
|
|
@@ -1132,7 +1139,7 @@ class GenericFilterComponent {
|
|
|
1132
1139
|
return { value: values, name };
|
|
1133
1140
|
}
|
|
1134
1141
|
else {
|
|
1135
|
-
return { value:
|
|
1142
|
+
return { value: getValues(field.options, values), name };
|
|
1136
1143
|
}
|
|
1137
1144
|
}
|
|
1138
1145
|
else {
|
|
@@ -1166,7 +1173,7 @@ class GenericFilterComponent {
|
|
|
1166
1173
|
GenericFilterComponent.decorators = [
|
|
1167
1174
|
{ type: Component, args: [{
|
|
1168
1175
|
selector: 'xuilib-generic-filter',
|
|
1169
|
-
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [id]=\"field.name\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"
|
|
1176
|
+
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [id]=\"field.name\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"fieldChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox-large'\">\n <div class=\"govuk-checkboxes\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'radio'\">\n <div class=\"govuk-radios\">\n <div *ngFor=\"let item of field.options\" class=\"govuk-radios__item\">\n <input type=\"radio\"\n [formControlName]=\"field.name\"\n [id]=\"'radio_' + item.key\"\n [attr.disabled]=\"disabled(field, form)\"\n [checked]=\"item.key === form.get(field.name).value\"\n class=\"govuk-radios__input\"\n [value]=\"item.key\"\n (change)=\"fieldChanged(field, form)\"\n />\n <label [for]=\"'radio_' + item.key\" class=\"govuk-label govuk-radios__label\">{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-person'\">\n <xuilib-find-person subTitle=\"\" (personSelected)=\"updatePersonControls($event, field)\"\n [submitted]=\"submitted\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [disabled]=\"disabled(field, form)\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location [form]=\"form\"\n [fields]=\"config.fields\"\n [title]=\"field.title\"\n [enableAddLocationButton]=\"field.enableAddLocationButton\"\n [disabled]=\"disabled(field, form)\"\n [selectedLocations]=\"form.get(field.name)?.value\"\n [submitted]=\"submitted\"\n [services]=\"form.get(field.findLocationField)?.value\"\n [field]=\"field\"\n ></xuilib-find-location>\n </ng-container>\n </div>\n </div>\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m govuk-section-break--visible\"/>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full\">\n <button\n class=\"govuk-button govuk-!-margin-right-1 govuk-!-margin-bottom-0\"\n type=\"submit\"\n id=\"applyFilter\"\n [disabled]=\"config.enableDisabledButton && form.invalid\"\n >{{config.applyButtonText || 'Apply'}}</button>\n <button\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n type=\"button\"\n id=\"cancelFilter\"\n (click)=\"cancelFilter()\">{{ config.cancelButtonText || 'Cancel'}}</button>\n </div>\n </div>\n</form>\n",
|
|
1170
1177
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1171
1178
|
encapsulation: ViewEncapsulation.None,
|
|
1172
1179
|
styles: [".contain-classes .elevated-break{position:relative;top:-10px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}"]
|
|
@@ -2779,131 +2786,6 @@ CookieBannerComponent.propDecorators = {
|
|
|
2779
2786
|
acceptanceNotifier: [{ type: Output }]
|
|
2780
2787
|
};
|
|
2781
2788
|
|
|
2782
|
-
/**
|
|
2783
|
-
* @fileoverview added by tsickle
|
|
2784
|
-
* Generated from: lib/components/find-location/find-location.component.ts
|
|
2785
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2786
|
-
*/
|
|
2787
|
-
class FindLocationComponent {
|
|
2788
|
-
constructor() {
|
|
2789
|
-
this.selectedLocations = [];
|
|
2790
|
-
this.submitted = true;
|
|
2791
|
-
this.locations = [];
|
|
2792
|
-
this.locationsForm = new FormArray([]);
|
|
2793
|
-
this.serviceIds = 'SSCS,IA';
|
|
2794
|
-
this.pServices = [];
|
|
2795
|
-
}
|
|
2796
|
-
/**
|
|
2797
|
-
* @return {?}
|
|
2798
|
-
*/
|
|
2799
|
-
get services() {
|
|
2800
|
-
return this.pServices;
|
|
2801
|
-
}
|
|
2802
|
-
/**
|
|
2803
|
-
* @param {?} value
|
|
2804
|
-
* @return {?}
|
|
2805
|
-
*/
|
|
2806
|
-
set services(value) {
|
|
2807
|
-
this.pServices = value;
|
|
2808
|
-
/** @type {?} */
|
|
2809
|
-
const field = this.fields.find((/**
|
|
2810
|
-
* @param {?} f
|
|
2811
|
-
* @return {?}
|
|
2812
|
-
*/
|
|
2813
|
-
f => f.name === this.field.findPersonField));
|
|
2814
|
-
if (field) {
|
|
2815
|
-
this.serviceIds = getCheckBoxesValues(field.options, value).filter((/**
|
|
2816
|
-
* @param {?} x
|
|
2817
|
-
* @return {?}
|
|
2818
|
-
*/
|
|
2819
|
-
x => x !== 'services_all')).join(',');
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
/**
|
|
2823
|
-
* @private
|
|
2824
|
-
* @param {?} selectedLocations
|
|
2825
|
-
* @param {?} formArray
|
|
2826
|
-
* @return {?}
|
|
2827
|
-
*/
|
|
2828
|
-
static initForm(selectedLocations, formArray) {
|
|
2829
|
-
for (const location of selectedLocations) {
|
|
2830
|
-
formArray.push(new FormControl(location));
|
|
2831
|
-
}
|
|
2832
|
-
return formArray;
|
|
2833
|
-
}
|
|
2834
|
-
/**
|
|
2835
|
-
* @return {?}
|
|
2836
|
-
*/
|
|
2837
|
-
ngOnInit() {
|
|
2838
|
-
this.locationsForm = FindLocationComponent.initForm(this.selectedLocations, this.locationsForm);
|
|
2839
|
-
}
|
|
2840
|
-
/**
|
|
2841
|
-
* @return {?}
|
|
2842
|
-
*/
|
|
2843
|
-
addLocation() {
|
|
2844
|
-
if (this.locations && this.locations.length) {
|
|
2845
|
-
/** @type {?} */
|
|
2846
|
-
const locationsForm = this.locationsForm;
|
|
2847
|
-
this.selectedLocations = (/** @type {?} */ (this.locationsForm.value));
|
|
2848
|
-
/** @type {?} */
|
|
2849
|
-
const formArray = (/** @type {?} */ (this.form.get(this.field.name)));
|
|
2850
|
-
/** @type {?} */
|
|
2851
|
-
const lastSavedValue = this.selectedLocations[this.selectedLocations.length - 1];
|
|
2852
|
-
FindLocationComponent.initForm([lastSavedValue], formArray);
|
|
2853
|
-
locationsForm.at(this.selectedLocations.length - 1).setValue(null);
|
|
2854
|
-
}
|
|
2855
|
-
this.locations = [];
|
|
2856
|
-
}
|
|
2857
|
-
/**
|
|
2858
|
-
* @param {?} location
|
|
2859
|
-
* @return {?}
|
|
2860
|
-
*/
|
|
2861
|
-
removeLocation(location) {
|
|
2862
|
-
if (location.epims_id) {
|
|
2863
|
-
this.selectedLocations = this.selectedLocations.filter((/**
|
|
2864
|
-
* @param {?} selectedLocation
|
|
2865
|
-
* @return {?}
|
|
2866
|
-
*/
|
|
2867
|
-
selectedLocation => selectedLocation.epims_id !== location.epims_id));
|
|
2868
|
-
/** @type {?} */
|
|
2869
|
-
const formArray = (/** @type {?} */ (this.form.get(this.field.name)));
|
|
2870
|
-
/** @type {?} */
|
|
2871
|
-
const index = ((/** @type {?} */ (formArray.value))).findIndex((/**
|
|
2872
|
-
* @param {?} selectedLocation
|
|
2873
|
-
* @return {?}
|
|
2874
|
-
*/
|
|
2875
|
-
selectedLocation => selectedLocation.epims_id === location.epims_id));
|
|
2876
|
-
if (index > -1) {
|
|
2877
|
-
formArray.removeAt(index);
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
/**
|
|
2882
|
-
* @param {?} location
|
|
2883
|
-
* @return {?}
|
|
2884
|
-
*/
|
|
2885
|
-
onLocationSelected(location) {
|
|
2886
|
-
if (location && location.epims_id) {
|
|
2887
|
-
this.locations = [...this.locations, location];
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
FindLocationComponent.decorators = [
|
|
2892
|
-
{ type: Component, args: [{
|
|
2893
|
-
selector: 'xuilib-find-location',
|
|
2894
|
-
template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\">Search for a location by name</label>\n </div>\n <exui-search-location class=\"search-location\"\n (locationSelected)=\"onLocationSelected($event)\"\n [selectedLocations]=\"selectedLocations\"\n [control]=\"locationsForm\"\n [locations]=\"locations\"\n [delay]=\"300\"\n [disabled]=false\n [serviceIds]=\"serviceIds\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\" class=\"govuk-button\" data-module=\"govuk-button\">\n Add location\n </a>\n </div>\n <ul *ngIf=\"selectedLocations.length\" class=\"hmcts-filter-tags selection-container\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedLocations\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeLocation(selection)\" href=\"javascript:void(0)\">\n {{ selection.court_name }}\n </a>\n </li>\n </ul>\n</div>\n",
|
|
2895
|
-
styles: [""]
|
|
2896
|
-
}] }
|
|
2897
|
-
];
|
|
2898
|
-
FindLocationComponent.propDecorators = {
|
|
2899
|
-
selectedLocations: [{ type: Input }],
|
|
2900
|
-
submitted: [{ type: Input }],
|
|
2901
|
-
form: [{ type: Input }],
|
|
2902
|
-
field: [{ type: Input }],
|
|
2903
|
-
fields: [{ type: Input }],
|
|
2904
|
-
services: [{ type: Input }]
|
|
2905
|
-
};
|
|
2906
|
-
|
|
2907
2789
|
/**
|
|
2908
2790
|
* @fileoverview added by tsickle
|
|
2909
2791
|
* Generated from: lib/services/locations/location.service.ts
|
|
@@ -2954,6 +2836,7 @@ class SearchLocationComponent {
|
|
|
2954
2836
|
this.fb = fb;
|
|
2955
2837
|
this.cd = cd;
|
|
2956
2838
|
this.disabled = null;
|
|
2839
|
+
this.singleMode = false;
|
|
2957
2840
|
this.locationType = '';
|
|
2958
2841
|
this.serviceIds = '';
|
|
2959
2842
|
this.submitted = true;
|
|
@@ -2961,51 +2844,51 @@ class SearchLocationComponent {
|
|
|
2961
2844
|
this.showAutocomplete = false;
|
|
2962
2845
|
this.locations = [];
|
|
2963
2846
|
this.locationSelected = new EventEmitter();
|
|
2964
|
-
this.term = '';
|
|
2965
|
-
this.readyAfterContent = false;
|
|
2966
2847
|
this.minSearchCharacters = 3;
|
|
2848
|
+
this.term = '';
|
|
2967
2849
|
this.pSelectedLocations = [];
|
|
2968
|
-
this.
|
|
2969
|
-
|
|
2970
|
-
|
|
2850
|
+
this.pReset = true;
|
|
2851
|
+
this.form = this.fb.group({
|
|
2852
|
+
searchTerm: ['']
|
|
2971
2853
|
});
|
|
2972
2854
|
}
|
|
2973
2855
|
/**
|
|
2974
2856
|
* @return {?}
|
|
2975
2857
|
*/
|
|
2976
|
-
get
|
|
2977
|
-
return this.
|
|
2858
|
+
get reset() {
|
|
2859
|
+
return this.pReset;
|
|
2978
2860
|
}
|
|
2979
2861
|
/**
|
|
2980
2862
|
* @param {?} value
|
|
2981
2863
|
* @return {?}
|
|
2982
2864
|
*/
|
|
2983
|
-
set
|
|
2984
|
-
this.
|
|
2985
|
-
this.
|
|
2865
|
+
set reset(value) {
|
|
2866
|
+
this.pReset = value;
|
|
2867
|
+
this.resetSearchTerm();
|
|
2986
2868
|
}
|
|
2987
2869
|
/**
|
|
2988
2870
|
* @return {?}
|
|
2989
2871
|
*/
|
|
2990
|
-
|
|
2991
|
-
this.
|
|
2872
|
+
get selectedLocations() {
|
|
2873
|
+
return this.pSelectedLocations;
|
|
2992
2874
|
}
|
|
2993
2875
|
/**
|
|
2876
|
+
* @param {?} value
|
|
2994
2877
|
* @return {?}
|
|
2995
2878
|
*/
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
if (this.findLocationFormGroup && this.findLocationFormGroup.controls) {
|
|
2999
|
-
this.findLocationFormGroup.controls.locationSelectedFormControl = this.control;
|
|
3000
|
-
}
|
|
3001
|
-
}
|
|
3002
|
-
this.search();
|
|
2879
|
+
set selectedLocations(value) {
|
|
2880
|
+
this.pSelectedLocations = value;
|
|
3003
2881
|
}
|
|
3004
2882
|
/**
|
|
3005
2883
|
* @return {?}
|
|
3006
2884
|
*/
|
|
3007
|
-
|
|
3008
|
-
this.
|
|
2885
|
+
ngOnInit() {
|
|
2886
|
+
if (this.singleMode && this.selectedLocations.length > 0) {
|
|
2887
|
+
/** @type {?} */
|
|
2888
|
+
const location = this.selectedLocations[0];
|
|
2889
|
+
this.form.controls.searchTerm.patchValue(location.court_name, { emitEvent: false, onlySelf: true });
|
|
2890
|
+
}
|
|
2891
|
+
this.search();
|
|
3009
2892
|
}
|
|
3010
2893
|
/**
|
|
3011
2894
|
* @param {?} term
|
|
@@ -3019,32 +2902,22 @@ class SearchLocationComponent {
|
|
|
3019
2902
|
(locations) => this.removeSelectedLocations(locations))));
|
|
3020
2903
|
}
|
|
3021
2904
|
/**
|
|
3022
|
-
* @param {
|
|
2905
|
+
* @param {?} location
|
|
3023
2906
|
* @return {?}
|
|
3024
2907
|
*/
|
|
3025
|
-
onSelectionChange(
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
}
|
|
3029
|
-
else {
|
|
3030
|
-
this.findLocationFormGroup.controls.locationSelectedFormControl.setValue(selection);
|
|
3031
|
-
}
|
|
3032
|
-
this.showAutocomplete = false;
|
|
3033
|
-
this.locationSelected.emit(selection);
|
|
3034
|
-
this.locations = [];
|
|
2908
|
+
onSelectionChange(location) {
|
|
2909
|
+
this.form.controls.searchTerm.patchValue(location.court_name, { emitEvent: false, onlySelf: true });
|
|
2910
|
+
this.locationSelected.emit(location);
|
|
3035
2911
|
}
|
|
3036
2912
|
/**
|
|
3037
2913
|
* @return {?}
|
|
3038
2914
|
*/
|
|
3039
2915
|
search() {
|
|
3040
|
-
this.
|
|
2916
|
+
this.form.controls.searchTerm.valueChanges
|
|
3041
2917
|
.pipe(tap((/**
|
|
3042
2918
|
* @return {?}
|
|
3043
2919
|
*/
|
|
3044
2920
|
() => this.locations = [])), tap((/**
|
|
3045
|
-
* @return {?}
|
|
3046
|
-
*/
|
|
3047
|
-
() => this.showAutocomplete = false)), tap((/**
|
|
3048
2921
|
* @param {?} term
|
|
3049
2922
|
* @return {?}
|
|
3050
2923
|
*/
|
|
@@ -3067,13 +2940,10 @@ class SearchLocationComponent {
|
|
|
3067
2940
|
locations => {
|
|
3068
2941
|
this.locations = locations;
|
|
3069
2942
|
this.cd.markForCheck();
|
|
3070
|
-
if (locations.length === 1 && this.term === locations[0].court_name) {
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
this.showAutocomplete = false;
|
|
3075
|
-
return;
|
|
3076
|
-
}
|
|
2943
|
+
if (locations.length === 1 && this.term === locations[0].court_name && !this.singleMode) {
|
|
2944
|
+
this.locationSelected.emit(locations[0]);
|
|
2945
|
+
this.showAutocomplete = false;
|
|
2946
|
+
return;
|
|
3077
2947
|
}
|
|
3078
2948
|
this.showAutocomplete = true;
|
|
3079
2949
|
}));
|
|
@@ -3088,20 +2958,8 @@ class SearchLocationComponent {
|
|
|
3088
2958
|
/**
|
|
3089
2959
|
* @return {?}
|
|
3090
2960
|
*/
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
/** @type {?} */
|
|
3094
|
-
const formArray = (/** @type {?} */ (this.findLocationFormGroup.controls.locationSelectedFormControl));
|
|
3095
|
-
if (formArray.length > 0) {
|
|
3096
|
-
/** @type {?} */
|
|
3097
|
-
const value = formArray.value[formArray.length - 1];
|
|
3098
|
-
return value ? formArray.value[formArray.length - 1].court_name : null;
|
|
3099
|
-
}
|
|
3100
|
-
}
|
|
3101
|
-
else {
|
|
3102
|
-
return this.findLocationFormGroup && this.findLocationFormGroup.controls && this.findLocationFormGroup.controls.locationSelectedFormControl.value ?
|
|
3103
|
-
((/** @type {?} */ (this.findLocationFormGroup.controls.locationSelectedFormControl.value))).court_name : '';
|
|
3104
|
-
}
|
|
2961
|
+
resetSearchTerm() {
|
|
2962
|
+
this.form.controls.searchTerm.patchValue('', { emitEvent: false, onlySelf: true });
|
|
3105
2963
|
}
|
|
3106
2964
|
/**
|
|
3107
2965
|
* @private
|
|
@@ -3109,6 +2967,9 @@ class SearchLocationComponent {
|
|
|
3109
2967
|
* @return {?}
|
|
3110
2968
|
*/
|
|
3111
2969
|
removeSelectedLocations(locations) {
|
|
2970
|
+
if (this.singleMode) {
|
|
2971
|
+
return locations;
|
|
2972
|
+
}
|
|
3112
2973
|
return locations.filter((/**
|
|
3113
2974
|
* @param {?} location
|
|
3114
2975
|
* @return {?}
|
|
@@ -3123,8 +2984,8 @@ class SearchLocationComponent {
|
|
|
3123
2984
|
SearchLocationComponent.decorators = [
|
|
3124
2985
|
{ type: Component, args: [{
|
|
3125
2986
|
selector: 'exui-search-location',
|
|
3126
|
-
template: "<div class=\"auto-complete-container\">\n <
|
|
3127
|
-
styles: [".autocomplete__input
|
|
2987
|
+
template: "<div class=\"auto-complete-container\">\n <input\n [formControl]=\"form.controls.searchTerm\"\n [matAutocomplete]=\"autoSearchLocation\"\n class=\"govuk-input\"\n [attr.disabled]=\"disabled\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchLocation=\"matAutocomplete\">\n <mat-option *ngFor=\"let location of locations\"\n (onSelectionChange)=\"onSelectionChange(location)\">\n {{ location.court_name }}\n </mat-option>\n <mat-option *ngIf=\"!locations.length && showAutocomplete && term && term.length >= this.minSearchCharacters\">No results found</mat-option>\n </mat-autocomplete>\n</div>\n",
|
|
2988
|
+
styles: [".autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:rgba(0,0,0,.256863) 0 2px 6px;left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-bottom:solid #b1b4b6;border-width:1px 0;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.31579}}.div-action{display:inline-block}.add-location{display:inline}.remove-location-button{margin:5px}.hide-autocomplete{display:none}.auto-complete-container{min-width:550px;display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
|
|
3128
2989
|
}] }
|
|
3129
2990
|
];
|
|
3130
2991
|
/** @nocollapse */
|
|
@@ -3136,17 +2997,186 @@ SearchLocationComponent.ctorParameters = () => [
|
|
|
3136
2997
|
SearchLocationComponent.propDecorators = {
|
|
3137
2998
|
control: [{ type: Input }],
|
|
3138
2999
|
disabled: [{ type: Input }],
|
|
3000
|
+
singleMode: [{ type: Input }],
|
|
3139
3001
|
locationType: [{ type: Input }],
|
|
3140
3002
|
serviceIds: [{ type: Input }],
|
|
3141
3003
|
submitted: [{ type: Input }],
|
|
3142
3004
|
delay: [{ type: Input }],
|
|
3143
|
-
|
|
3005
|
+
form: [{ type: Input }],
|
|
3144
3006
|
showAutocomplete: [{ type: Input }],
|
|
3145
3007
|
locations: [{ type: Input }],
|
|
3146
3008
|
locationSelected: [{ type: Output }],
|
|
3009
|
+
reset: [{ type: Input }],
|
|
3147
3010
|
selectedLocations: [{ type: Input }]
|
|
3148
3011
|
};
|
|
3149
3012
|
|
|
3013
|
+
/**
|
|
3014
|
+
* @fileoverview added by tsickle
|
|
3015
|
+
* Generated from: lib/components/find-location/find-location.component.ts
|
|
3016
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3017
|
+
*/
|
|
3018
|
+
class FindLocationComponent {
|
|
3019
|
+
constructor() {
|
|
3020
|
+
this.selectedLocations = [];
|
|
3021
|
+
this.submitted = true;
|
|
3022
|
+
this.enableAddLocationButton = true;
|
|
3023
|
+
this.title = 'Search for a location by name';
|
|
3024
|
+
this.locations = [];
|
|
3025
|
+
this.tempSelectedLocation = null;
|
|
3026
|
+
this.serviceIds = 'SSCS,IA';
|
|
3027
|
+
this.pServices = [];
|
|
3028
|
+
this.pDisabled = false;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* @return {?}
|
|
3032
|
+
*/
|
|
3033
|
+
get disabled() {
|
|
3034
|
+
return this.pDisabled;
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* @param {?} value
|
|
3038
|
+
* @return {?}
|
|
3039
|
+
*/
|
|
3040
|
+
set disabled(value) {
|
|
3041
|
+
if (value) {
|
|
3042
|
+
this.searchLocationComponent.resetSearchTerm();
|
|
3043
|
+
this.removeSelectedValues();
|
|
3044
|
+
}
|
|
3045
|
+
this.pDisabled = value;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* @return {?}
|
|
3049
|
+
*/
|
|
3050
|
+
get services() {
|
|
3051
|
+
return this.pServices;
|
|
3052
|
+
}
|
|
3053
|
+
/**
|
|
3054
|
+
* @param {?} value
|
|
3055
|
+
* @return {?}
|
|
3056
|
+
*/
|
|
3057
|
+
set services(value) {
|
|
3058
|
+
this.pServices = value;
|
|
3059
|
+
/** @type {?} */
|
|
3060
|
+
const field = this.fields.find((/**
|
|
3061
|
+
* @param {?} f
|
|
3062
|
+
* @return {?}
|
|
3063
|
+
*/
|
|
3064
|
+
f => f.name === this.field.findLocationField));
|
|
3065
|
+
if (field) {
|
|
3066
|
+
if (typeof value === 'string') {
|
|
3067
|
+
this.serviceIds = value;
|
|
3068
|
+
}
|
|
3069
|
+
else {
|
|
3070
|
+
this.serviceIds = getValues(field.options, value).filter((/**
|
|
3071
|
+
* @param {?} x
|
|
3072
|
+
* @return {?}
|
|
3073
|
+
*/
|
|
3074
|
+
x => x !== 'services_all')).join(',');
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
/**
|
|
3079
|
+
* @return {?}
|
|
3080
|
+
*/
|
|
3081
|
+
addLocation() {
|
|
3082
|
+
if (this.tempSelectedLocation) {
|
|
3083
|
+
this.selectedLocations = [...this.selectedLocations, this.tempSelectedLocation];
|
|
3084
|
+
this.addSelectedLocationsToForm([this.tempSelectedLocation]);
|
|
3085
|
+
this.tempSelectedLocation = null;
|
|
3086
|
+
this.locations = [];
|
|
3087
|
+
this.searchLocationComponent.resetSearchTerm();
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* @param {?} location
|
|
3092
|
+
* @return {?}
|
|
3093
|
+
*/
|
|
3094
|
+
removeLocation(location) {
|
|
3095
|
+
if (location.epims_id) {
|
|
3096
|
+
this.selectedLocations = this.selectedLocations.filter((/**
|
|
3097
|
+
* @param {?} selectedLocation
|
|
3098
|
+
* @return {?}
|
|
3099
|
+
*/
|
|
3100
|
+
selectedLocation => selectedLocation.epims_id !== location.epims_id));
|
|
3101
|
+
/** @type {?} */
|
|
3102
|
+
const formArray = (/** @type {?} */ (this.form.get(this.field.name)));
|
|
3103
|
+
/** @type {?} */
|
|
3104
|
+
const index = ((/** @type {?} */ (formArray.value))).findIndex((/**
|
|
3105
|
+
* @param {?} selectedLocation
|
|
3106
|
+
* @return {?}
|
|
3107
|
+
*/
|
|
3108
|
+
selectedLocation => selectedLocation.epims_id === location.epims_id));
|
|
3109
|
+
if (index > -1) {
|
|
3110
|
+
formArray.removeAt(index);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
/**
|
|
3115
|
+
* @param {?} location
|
|
3116
|
+
* @return {?}
|
|
3117
|
+
*/
|
|
3118
|
+
onLocationSelected(location) {
|
|
3119
|
+
if (this.field.maxSelected === 1) {
|
|
3120
|
+
this.removeSelectedValues();
|
|
3121
|
+
this.addSelectedLocationsToForm([location]);
|
|
3122
|
+
}
|
|
3123
|
+
else {
|
|
3124
|
+
if (!this.selectedLocations.find((/**
|
|
3125
|
+
* @param {?} x
|
|
3126
|
+
* @return {?}
|
|
3127
|
+
*/
|
|
3128
|
+
x => x.epims_id === location.epims_id))) {
|
|
3129
|
+
if (location.epims_id) {
|
|
3130
|
+
this.tempSelectedLocation = location;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* @private
|
|
3137
|
+
* @return {?}
|
|
3138
|
+
*/
|
|
3139
|
+
removeSelectedValues() {
|
|
3140
|
+
/** @type {?} */
|
|
3141
|
+
const formArray = (/** @type {?} */ (this.form.get(this.field.name)));
|
|
3142
|
+
for (let i = 0; i < formArray.length; i++) {
|
|
3143
|
+
formArray.removeAt(i);
|
|
3144
|
+
}
|
|
3145
|
+
this.selectedLocations = [];
|
|
3146
|
+
}
|
|
3147
|
+
/**
|
|
3148
|
+
* @private
|
|
3149
|
+
* @param {?} locations
|
|
3150
|
+
* @return {?}
|
|
3151
|
+
*/
|
|
3152
|
+
addSelectedLocationsToForm(locations) {
|
|
3153
|
+
/** @type {?} */
|
|
3154
|
+
const formArray = (/** @type {?} */ (this.form.get(this.field.name)));
|
|
3155
|
+
for (const location of locations) {
|
|
3156
|
+
formArray.push(new FormControl(location));
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
FindLocationComponent.decorators = [
|
|
3161
|
+
{ type: Component, args: [{
|
|
3162
|
+
selector: 'xuilib-find-location',
|
|
3163
|
+
template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"title\">{{title}}</label>\n </div>\n <exui-search-location class=\"search-location\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationSelected)=\"onLocationSelected($event)\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\" class=\"govuk-button\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add location\n </a>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedLocations\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeLocation(selection)\" href=\"javascript:void(0)\">\n {{ selection.court_name }}\n </a>\n </li>\n </ul>\n</div>\n",
|
|
3164
|
+
styles: [""]
|
|
3165
|
+
}] }
|
|
3166
|
+
];
|
|
3167
|
+
FindLocationComponent.propDecorators = {
|
|
3168
|
+
selectedLocations: [{ type: Input }],
|
|
3169
|
+
submitted: [{ type: Input }],
|
|
3170
|
+
enableAddLocationButton: [{ type: Input }],
|
|
3171
|
+
form: [{ type: Input }],
|
|
3172
|
+
field: [{ type: Input }],
|
|
3173
|
+
fields: [{ type: Input }],
|
|
3174
|
+
title: [{ type: Input }],
|
|
3175
|
+
searchLocationComponent: [{ type: ViewChild, args: [SearchLocationComponent,] }],
|
|
3176
|
+
disabled: [{ type: Input }],
|
|
3177
|
+
services: [{ type: Input }]
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3150
3180
|
/**
|
|
3151
3181
|
* @fileoverview added by tsickle
|
|
3152
3182
|
* Generated from: lib/components/pagination/pagination.component.ts
|
|
@@ -3462,6 +3492,49 @@ class RadioFilterFieldConfig {
|
|
|
3462
3492
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3463
3493
|
*/
|
|
3464
3494
|
|
|
3495
|
+
/**
|
|
3496
|
+
* @fileoverview added by tsickle
|
|
3497
|
+
* Generated from: lib/gov-ui/util/session-storage/session-storage-utils.ts
|
|
3498
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3499
|
+
*/
|
|
3500
|
+
/** @type {?} */
|
|
3501
|
+
const getAllCaseworkersFromServices = (/**
|
|
3502
|
+
* @param {?} caseworkersByService
|
|
3503
|
+
* @return {?}
|
|
3504
|
+
*/
|
|
3505
|
+
(caseworkersByService) => {
|
|
3506
|
+
/** @type {?} */
|
|
3507
|
+
let allCaseworkers = [];
|
|
3508
|
+
caseworkersByService.forEach((/**
|
|
3509
|
+
* @param {?} caseworkerListByService
|
|
3510
|
+
* @return {?}
|
|
3511
|
+
*/
|
|
3512
|
+
caseworkerListByService => {
|
|
3513
|
+
allCaseworkers = allCaseworkers.concat(caseworkerListByService.caseworkers);
|
|
3514
|
+
}));
|
|
3515
|
+
return allCaseworkers;
|
|
3516
|
+
});
|
|
3517
|
+
/** @type {?} */
|
|
3518
|
+
const getSessionStorageKeyForServiceId = (/**
|
|
3519
|
+
* @param {?} serviceId
|
|
3520
|
+
* @return {?}
|
|
3521
|
+
*/
|
|
3522
|
+
(serviceId) => {
|
|
3523
|
+
return `${serviceId}-caseworkers`;
|
|
3524
|
+
});
|
|
3525
|
+
/** @type {?} */
|
|
3526
|
+
const setCaseworkers = (/**
|
|
3527
|
+
* @param {?} serviceId
|
|
3528
|
+
* @param {?} caseworkers
|
|
3529
|
+
* @param {?} sessionStorageService
|
|
3530
|
+
* @return {?}
|
|
3531
|
+
*/
|
|
3532
|
+
(serviceId, caseworkers, sessionStorageService) => {
|
|
3533
|
+
/** @type {?} */
|
|
3534
|
+
const sessionKey = getSessionStorageKeyForServiceId(serviceId);
|
|
3535
|
+
sessionStorageService.setItem(sessionKey, JSON.stringify(caseworkers));
|
|
3536
|
+
});
|
|
3537
|
+
|
|
3465
3538
|
/**
|
|
3466
3539
|
* @fileoverview added by tsickle
|
|
3467
3540
|
* Generated from: lib/services/session-storage/session-storage.service.ts
|
|
@@ -3555,35 +3628,60 @@ class FindAPersonService {
|
|
|
3555
3628
|
const userInfo = JSON.parse(userInfoStr);
|
|
3556
3629
|
this.userId = userInfo.id ? userInfo.id : userInfo.uid;
|
|
3557
3630
|
}
|
|
3558
|
-
if (!this.sessionStorageService.getItem(FindAPersonService.caseworkersKey)) {
|
|
3559
|
-
this.http.get('/workallocation2/caseworker').pipe(tap((/**
|
|
3560
|
-
* @param {?} caseworkerList
|
|
3561
|
-
* @return {?}
|
|
3562
|
-
*/
|
|
3563
|
-
caseworkerList => this.sessionStorageService.setItem(FindAPersonService.caseworkersKey, JSON.stringify(caseworkerList)))));
|
|
3564
|
-
}
|
|
3565
|
-
/** @type {?} */
|
|
3566
|
-
const caseworkers = JSON.parse(this.sessionStorageService.getItem(FindAPersonService.caseworkersKey));
|
|
3567
3631
|
/** @type {?} */
|
|
3568
|
-
|
|
3569
|
-
if (!(searchOptions.jurisdiction === PersonRole.ALL)) {
|
|
3570
|
-
roleCategory = searchOptions.jurisdiction === PersonRole.CASEWORKER ? RoleCategory.CASEWORKER : RoleCategory.ADMIN;
|
|
3571
|
-
}
|
|
3632
|
+
const fullServices = searchOptions.services;
|
|
3572
3633
|
/** @type {?} */
|
|
3573
|
-
const
|
|
3634
|
+
const storedServices = [];
|
|
3574
3635
|
/** @type {?} */
|
|
3575
|
-
const
|
|
3636
|
+
const newServices = [];
|
|
3576
3637
|
/** @type {?} */
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3638
|
+
const storedCaseworkersByService = [];
|
|
3639
|
+
fullServices.forEach((/**
|
|
3640
|
+
* @param {?} serviceId
|
|
3579
3641
|
* @return {?}
|
|
3580
3642
|
*/
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3643
|
+
serviceId => {
|
|
3644
|
+
/** @type {?} */
|
|
3645
|
+
const serviceKey = getSessionStorageKeyForServiceId(serviceId);
|
|
3646
|
+
if (this.sessionStorageService.getItem(serviceKey)) {
|
|
3647
|
+
storedServices.push(serviceId);
|
|
3648
|
+
storedCaseworkersByService.push({ service: serviceId, caseworkers: JSON.parse(this.sessionStorageService.getItem(serviceKey)) });
|
|
3649
|
+
}
|
|
3650
|
+
else {
|
|
3651
|
+
newServices.push(serviceId);
|
|
3652
|
+
}
|
|
3653
|
+
}));
|
|
3654
|
+
// if all services are stored then return the stored caseworkers by service
|
|
3655
|
+
if (storedServices.length === fullServices.length) {
|
|
3656
|
+
/** @type {?} */
|
|
3657
|
+
const storedCaseworkers = getAllCaseworkersFromServices(storedCaseworkersByService);
|
|
3658
|
+
return of(this.searchInCaseworkers(storedCaseworkers, searchOptions));
|
|
3659
|
+
}
|
|
3660
|
+
// all serviceIds passed in as node layer getting used anyway and caseworkers also stored there
|
|
3661
|
+
return this.http.post('/workallocation2/retrieveCaseWorkersForServices', { fullServices }).pipe(tap((/**
|
|
3662
|
+
* @param {?} caseworkersByService
|
|
3663
|
+
* @return {?}
|
|
3664
|
+
*/
|
|
3665
|
+
caseworkersByService => {
|
|
3666
|
+
caseworkersByService.forEach((/**
|
|
3667
|
+
* @param {?} caseworkerListByService
|
|
3668
|
+
* @return {?}
|
|
3669
|
+
*/
|
|
3670
|
+
caseworkerListByService => {
|
|
3671
|
+
// for any new service, ensure that they are then stored in the session
|
|
3672
|
+
if (newServices.includes(caseworkerListByService.service)) {
|
|
3673
|
+
setCaseworkers(caseworkerListByService.service, caseworkerListByService.caseworkers, this.sessionStorageService);
|
|
3674
|
+
}
|
|
3675
|
+
}));
|
|
3676
|
+
})), map((/**
|
|
3677
|
+
* @param {?} caseworkersByService
|
|
3584
3678
|
* @return {?}
|
|
3585
3679
|
*/
|
|
3586
|
-
|
|
3680
|
+
caseworkersByService => {
|
|
3681
|
+
/** @type {?} */
|
|
3682
|
+
const givenCaseworkers = getAllCaseworkersFromServices(caseworkersByService);
|
|
3683
|
+
return this.searchInCaseworkers(givenCaseworkers, searchOptions);
|
|
3684
|
+
})));
|
|
3587
3685
|
}
|
|
3588
3686
|
/**
|
|
3589
3687
|
* @param {?} caseworkers
|
|
@@ -3611,6 +3709,33 @@ class FindAPersonService {
|
|
|
3611
3709
|
}));
|
|
3612
3710
|
return people;
|
|
3613
3711
|
}
|
|
3712
|
+
/**
|
|
3713
|
+
* @param {?} caseworkers
|
|
3714
|
+
* @param {?} searchOptions
|
|
3715
|
+
* @return {?}
|
|
3716
|
+
*/
|
|
3717
|
+
searchInCaseworkers(caseworkers, searchOptions) {
|
|
3718
|
+
/** @type {?} */
|
|
3719
|
+
let roleCategory = RoleCategory.ALL;
|
|
3720
|
+
if (!(searchOptions.userRole === PersonRole.ALL)) {
|
|
3721
|
+
roleCategory = searchOptions.userRole === PersonRole.CASEWORKER ? RoleCategory.CASEWORKER : RoleCategory.ADMIN;
|
|
3722
|
+
}
|
|
3723
|
+
/** @type {?} */
|
|
3724
|
+
const searchTerm = searchOptions && searchOptions.searchTerm ? searchOptions.searchTerm.toLowerCase() : '';
|
|
3725
|
+
/** @type {?} */
|
|
3726
|
+
const people = caseworkers ? this.mapCaseworkers(caseworkers, roleCategory) : [];
|
|
3727
|
+
/** @type {?} */
|
|
3728
|
+
const finalPeopleList = people.filter((/**
|
|
3729
|
+
* @param {?} person
|
|
3730
|
+
* @return {?}
|
|
3731
|
+
*/
|
|
3732
|
+
person => person && person.name && person.name.toLowerCase().includes(searchTerm)));
|
|
3733
|
+
return searchOptions.userIncluded ? finalPeopleList : finalPeopleList.filter((/**
|
|
3734
|
+
* @param {?} person
|
|
3735
|
+
* @return {?}
|
|
3736
|
+
*/
|
|
3737
|
+
person => person && person.id !== this.userId));
|
|
3738
|
+
}
|
|
3614
3739
|
}
|
|
3615
3740
|
FindAPersonService.caseworkersKey = 'caseworkers';
|
|
3616
3741
|
FindAPersonService.decorators = [
|
|
@@ -3633,9 +3758,11 @@ FindAPersonService.ctorParameters = () => [
|
|
|
3633
3758
|
class FindPersonComponent {
|
|
3634
3759
|
/**
|
|
3635
3760
|
* @param {?} findPersonService
|
|
3761
|
+
* @param {?} cd
|
|
3636
3762
|
*/
|
|
3637
|
-
constructor(findPersonService) {
|
|
3763
|
+
constructor(findPersonService, cd) {
|
|
3638
3764
|
this.findPersonService = findPersonService;
|
|
3765
|
+
this.cd = cd;
|
|
3639
3766
|
this.personSelected = new EventEmitter();
|
|
3640
3767
|
this.boldTitle = 'Find the person';
|
|
3641
3768
|
this.subTitle = 'Type the name of the person and select them.';
|
|
@@ -3644,16 +3771,18 @@ class FindPersonComponent {
|
|
|
3644
3771
|
this.disabled = null;
|
|
3645
3772
|
this.userIncluded = false;
|
|
3646
3773
|
this.placeholderContent = '';
|
|
3647
|
-
this.isNoResultsShown =
|
|
3774
|
+
this.isNoResultsShown = true;
|
|
3648
3775
|
this.showUpdatedColor = false;
|
|
3649
3776
|
this.selectedPersons = [];
|
|
3650
3777
|
this.errorMessage = 'You must select a name';
|
|
3651
3778
|
this.idValue = '';
|
|
3779
|
+
this.services = ['IA'];
|
|
3652
3780
|
this.isPersonSelectionCompleted = false;
|
|
3653
3781
|
this.showAutocomplete = false;
|
|
3654
3782
|
this.currentInputValue = '';
|
|
3655
|
-
this.
|
|
3656
|
-
this.findPersonControl = new FormControl();
|
|
3783
|
+
this.chosenPerson = null;
|
|
3784
|
+
this.findPersonControl = new FormControl('');
|
|
3785
|
+
this.filteredOptions = [];
|
|
3657
3786
|
this.minSearchCharacters = 2;
|
|
3658
3787
|
}
|
|
3659
3788
|
/**
|
|
@@ -3666,13 +3795,34 @@ class FindPersonComponent {
|
|
|
3666
3795
|
else {
|
|
3667
3796
|
this.findPersonGroup.addControl('findPersonControl', this.findPersonControl);
|
|
3668
3797
|
}
|
|
3669
|
-
this.
|
|
3798
|
+
this.findPersonControl.valueChanges.pipe(startWith(''), tap((/**
|
|
3799
|
+
* @return {?}
|
|
3800
|
+
*/
|
|
3801
|
+
() => this.showAutocomplete = false)), tap((/**
|
|
3802
|
+
* @return {?}
|
|
3803
|
+
*/
|
|
3804
|
+
() => this.filteredOptions = [])), filter((/**
|
|
3670
3805
|
* @param {?} searchTerm
|
|
3671
3806
|
* @return {?}
|
|
3672
3807
|
*/
|
|
3673
|
-
searchTerm =>
|
|
3674
|
-
|
|
3675
|
-
|
|
3808
|
+
searchTerm => searchTerm && searchTerm.length > this.minSearchCharacters)), switchMap((/**
|
|
3809
|
+
* @param {?} searchTerm
|
|
3810
|
+
* @return {?}
|
|
3811
|
+
*/
|
|
3812
|
+
searchTerm => this.filter(searchTerm).pipe(tap((/**
|
|
3813
|
+
* @return {?}
|
|
3814
|
+
*/
|
|
3815
|
+
() => this.showAutocomplete = true)), catchError((/**
|
|
3816
|
+
* @return {?}
|
|
3817
|
+
*/
|
|
3818
|
+
() => this.filteredOptions = [])))))).subscribe((/**
|
|
3819
|
+
* @param {?} people
|
|
3820
|
+
* @return {?}
|
|
3821
|
+
*/
|
|
3822
|
+
(people) => {
|
|
3823
|
+
this.filteredOptions = people;
|
|
3824
|
+
this.cd.detectChanges();
|
|
3825
|
+
}));
|
|
3676
3826
|
this.findPersonControl.setValue(this.selectedPerson);
|
|
3677
3827
|
}
|
|
3678
3828
|
/**
|
|
@@ -3695,9 +3845,9 @@ class FindPersonComponent {
|
|
|
3695
3845
|
*/
|
|
3696
3846
|
filter(searchTerm) {
|
|
3697
3847
|
/** @type {?} */
|
|
3698
|
-
const findJudicialPeople = this.findPersonService.find({ searchTerm,
|
|
3848
|
+
const findJudicialPeople = this.findPersonService.find({ searchTerm, userRole: this.domain, services: this.services });
|
|
3699
3849
|
/** @type {?} */
|
|
3700
|
-
const findCaseworkersOrAdmins = this.findPersonService.findCaseworkers({ searchTerm,
|
|
3850
|
+
const findCaseworkersOrAdmins = this.findPersonService.findCaseworkers({ searchTerm, userRole: this.domain, services: this.services });
|
|
3701
3851
|
if (searchTerm && searchTerm.length > this.minSearchCharacters) {
|
|
3702
3852
|
switch (this.domain) {
|
|
3703
3853
|
case PersonRole.JUDICIAL: {
|
|
@@ -3731,20 +3881,21 @@ class FindPersonComponent {
|
|
|
3731
3881
|
return findCaseworkersOrAdmins;
|
|
3732
3882
|
}
|
|
3733
3883
|
default: {
|
|
3734
|
-
return of();
|
|
3884
|
+
return of([]);
|
|
3735
3885
|
}
|
|
3736
3886
|
}
|
|
3737
3887
|
}
|
|
3738
|
-
return of();
|
|
3888
|
+
return of([]);
|
|
3739
3889
|
}
|
|
3740
3890
|
/**
|
|
3741
|
-
* @param {
|
|
3891
|
+
* @param {?} selectedPerson
|
|
3742
3892
|
* @return {?}
|
|
3743
3893
|
*/
|
|
3744
3894
|
onSelectionChange(selectedPerson) {
|
|
3745
3895
|
this.isPersonSelectionCompleted = true;
|
|
3746
|
-
this.
|
|
3896
|
+
this.chosenPerson = selectedPerson;
|
|
3747
3897
|
this.personSelected.emit(selectedPerson);
|
|
3898
|
+
this.findPersonControl.setValue('');
|
|
3748
3899
|
}
|
|
3749
3900
|
/**
|
|
3750
3901
|
* @param {?} currentValue
|
|
@@ -3753,13 +3904,16 @@ class FindPersonComponent {
|
|
|
3753
3904
|
updatedVal(currentValue) {
|
|
3754
3905
|
this.currentInputValue = currentValue;
|
|
3755
3906
|
this.showAutocomplete = !!currentValue && (currentValue.length > this.minSearchCharacters);
|
|
3756
|
-
this.isPersonSelectionCompleted =
|
|
3907
|
+
this.isPersonSelectionCompleted = this.getDisplayName(this.chosenPerson) === currentValue;
|
|
3757
3908
|
}
|
|
3758
3909
|
/**
|
|
3759
3910
|
* @param {?} selectedPerson
|
|
3760
3911
|
* @return {?}
|
|
3761
3912
|
*/
|
|
3762
3913
|
getDisplayName(selectedPerson) {
|
|
3914
|
+
if (!selectedPerson) {
|
|
3915
|
+
return '';
|
|
3916
|
+
}
|
|
3763
3917
|
if (selectedPerson.domain === PersonRole.JUDICIAL && selectedPerson.knownAs) {
|
|
3764
3918
|
return `${selectedPerson.knownAs}(${selectedPerson.email})`;
|
|
3765
3919
|
}
|
|
@@ -3769,13 +3923,14 @@ class FindPersonComponent {
|
|
|
3769
3923
|
FindPersonComponent.decorators = [
|
|
3770
3924
|
{ type: Component, args: [{
|
|
3771
3925
|
selector: 'xuilib-find-person',
|
|
3772
|
-
template: "<h1 class=\"govuk-heading-l\" *ngIf=\"title && title.length\">\n <span class=\"govuk-caption-l\">{{title}}</span>\n {{boldTitle}}\n</h1>\n<div class=\"govuk-form-group\" [formGroup]=\"findPersonGroup\"\n [ngClass]=\"{'form-group-error':
|
|
3926
|
+
template: "<h1 class=\"govuk-heading-l\" *ngIf=\"title && title.length\">\n <span class=\"govuk-caption-l\">{{title}}</span>\n {{boldTitle}}\n</h1>\n<div class=\"govuk-form-group\" [formGroup]=\"findPersonGroup\"\n [ngClass]=\"{'form-group-error': findPersonGroup.get('findPersonControl').invalid && submitted}\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"sub-title-hint\">\n <div id=\"sub-title-hint\" class=\"govuk-hint\" *ngIf=\"subTitle && subTitle.length\">\n {{subTitle}}\n </div>\n <span id=\"validation-error\" class=\"govuk-error-message\" *ngIf=\"findPersonGroup && findPersonGroup.errors\">\n <span class=\"govuk-visually-hidden\">Error:</span>{{findPersonGroup.errors.error ? findPersonGroup.errors.error : errorMessage}}\n </span>\n <input id=\"inputSelectPerson{{idValue}}\" type=\"text\" aria-label=\"select a person\" matInput\n formControlName=\"findPersonControl\"\n [matAutocomplete]=\"auto\"\n class=\"govuk-input govuk-!-width-one-third\"\n (ngModelChange)=\"updatedVal($event)\"\n [placeholder]=\"placeholderContent\"\n [attr.disabled]=\"disabled\"\n [value]=\"selectedPerson\">\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of filteredOptions\"\n [value]=\"getDisplayName(option)\"\n (onSelectionChange)=\"onSelectionChange(option)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete, 'select-option': showUpdatedColor}\">\n {{getDisplayName(option)}}\n </mat-option>\n <mat-option [ngClass]=\"{'select-option': showUpdatedColor}\" *ngIf=\"isNoResultsShown && currentInputValue && currentInputValue.length > minSearchCharacters && !filteredOptions.length && showAutocomplete\">No results found</mat-option>\n </mat-autocomplete>\n </fieldset>\n</div>\n",
|
|
3773
3927
|
styles: [".mat-option:hover{background:#2596be}.mat-option.select-option:hover{background:#1d70b8;color:#fff}.hide-autocomplete{display:none}"]
|
|
3774
3928
|
}] }
|
|
3775
3929
|
];
|
|
3776
3930
|
/** @nocollapse */
|
|
3777
3931
|
FindPersonComponent.ctorParameters = () => [
|
|
3778
|
-
{ type: FindAPersonService }
|
|
3932
|
+
{ type: FindAPersonService },
|
|
3933
|
+
{ type: ChangeDetectorRef }
|
|
3779
3934
|
];
|
|
3780
3935
|
FindPersonComponent.propDecorators = {
|
|
3781
3936
|
personSelected: [{ type: Output }],
|
|
@@ -3793,7 +3948,8 @@ FindPersonComponent.propDecorators = {
|
|
|
3793
3948
|
showUpdatedColor: [{ type: Input }],
|
|
3794
3949
|
selectedPersons: [{ type: Input }],
|
|
3795
3950
|
errorMessage: [{ type: Input }],
|
|
3796
|
-
idValue: [{ type: Input }]
|
|
3951
|
+
idValue: [{ type: Input }],
|
|
3952
|
+
services: [{ type: Input }]
|
|
3797
3953
|
};
|
|
3798
3954
|
|
|
3799
3955
|
/**
|
|
@@ -4721,7 +4877,8 @@ ExuiCommonLibModule.decorators = [
|
|
|
4721
4877
|
ReactiveFormsModule,
|
|
4722
4878
|
RouterModule.forChild([]),
|
|
4723
4879
|
MatAutocompleteModule,
|
|
4724
|
-
MatTabsModule
|
|
4880
|
+
MatTabsModule,
|
|
4881
|
+
MatInputModule
|
|
4725
4882
|
],
|
|
4726
4883
|
providers: [
|
|
4727
4884
|
{ provide: windowToken, useFactory: ɵ0 }
|