@hmcts/rpx-xui-common-lib 1.7.47 → 1.7.48-filter-skill-by-service

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bundles/hmcts-rpx-xui-common-lib.umd.js +508 -57
  2. package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
  3. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
  4. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
  5. package/esm2015/hmcts-rpx-xui-common-lib.js +3 -2
  6. package/esm2015/lib/components/find-location/find-location.component.js +2 -2
  7. package/esm2015/lib/components/find-service/find-service.component.js +128 -27
  8. package/esm2015/lib/components/generic-filter/generic-filter-utils.js +1 -1
  9. package/esm2015/lib/components/generic-filter/generic-filter.component.js +279 -13
  10. package/esm2015/lib/components/search-location/search-location.component.js +2 -2
  11. package/esm2015/lib/components/search-service/search-service.component.js +16 -33
  12. package/esm2015/lib/exui-common-lib.module.js +10 -3
  13. package/esm2015/lib/models/filter.model.js +55 -3
  14. package/esm2015/lib/pipes/capitalize.pipe.js +21 -0
  15. package/esm2015/lib/services/filter/filter.service.js +19 -5
  16. package/esm2015/lib/services/find-person/find-person.service.js +3 -3
  17. package/esm2015/lib/services/storage/session-storage/session-storage.service.js +55 -0
  18. package/esm5/hmcts-rpx-xui-common-lib.js +3 -2
  19. package/esm5/lib/components/find-location/find-location.component.js +2 -2
  20. package/esm5/lib/components/find-service/find-service.component.js +166 -25
  21. package/esm5/lib/components/generic-filter/generic-filter-utils.js +1 -1
  22. package/esm5/lib/components/generic-filter/generic-filter.component.js +306 -12
  23. package/esm5/lib/components/search-location/search-location.component.js +2 -2
  24. package/esm5/lib/components/search-service/search-service.component.js +18 -37
  25. package/esm5/lib/exui-common-lib.module.js +8 -3
  26. package/esm5/lib/models/filter.model.js +55 -3
  27. package/esm5/lib/pipes/capitalize.pipe.js +29 -0
  28. package/esm5/lib/services/filter/filter.service.js +23 -5
  29. package/esm5/lib/services/find-person/find-person.service.js +3 -3
  30. package/esm5/lib/services/{session-storage → storage/session-storage}/session-storage.service.js +2 -2
  31. package/fesm2015/hmcts-rpx-xui-common-lib.js +456 -56
  32. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
  33. package/fesm5/hmcts-rpx-xui-common-lib.js +531 -57
  34. package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
  35. package/hmcts-rpx-xui-common-lib.d.ts +2 -1
  36. package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
  37. package/lib/components/find-service/find-service.component.d.ts +15 -9
  38. package/lib/components/generic-filter/generic-filter-utils.d.ts +2 -5
  39. package/lib/components/generic-filter/generic-filter.component.d.ts +10 -2
  40. package/lib/components/search-location/search-location.component.d.ts +1 -1
  41. package/lib/components/search-service/search-service.component.d.ts +5 -11
  42. package/lib/exui-common-lib.module.d.ts +1 -2
  43. package/lib/models/filter.model.d.ts +25 -7
  44. package/lib/pipes/capitalize.pipe.d.ts +4 -0
  45. package/lib/services/filter/filter.service.d.ts +1 -0
  46. package/lib/services/find-person/find-person.service.d.ts +1 -1
  47. package/lib/services/{session-storage → storage/session-storage}/session-storage.service.d.ts +0 -0
  48. package/package.json +1 -1
  49. package/esm2015/lib/services/session-storage/session-storage.service.js +0 -55
@@ -709,10 +709,10 @@
709
709
  return this.filterSettings[id];
710
710
  }
711
711
  if (sessionStorage.getItem(id)) {
712
- return JSON.parse(window.sessionStorage.getItem(id));
712
+ return JSON.parse(sessionStorage.getItem(id));
713
713
  }
714
714
  if (localStorage.getItem(id)) {
715
- return JSON.parse(window.localStorage.getItem(id));
715
+ return JSON.parse(localStorage.getItem(id));
716
716
  }
717
717
  return null;
718
718
  };
@@ -730,6 +730,24 @@
730
730
  }
731
731
  return this.streams[id].asObservable();
732
732
  };
733
+ /**
734
+ * @param {?} id
735
+ * @return {?}
736
+ */
737
+ FilterService.prototype.clearSessionAndLocalPersistance = /**
738
+ * @param {?} id
739
+ * @return {?}
740
+ */
741
+ function (id) {
742
+ sessionStorage.removeItem(id);
743
+ localStorage.removeItem(id);
744
+ if (this.filterSettings[id] !== undefined) {
745
+ this.filterSettings[id] = null;
746
+ }
747
+ if (this.streams[id] !== undefined) {
748
+ this.streams[id].next(null);
749
+ }
750
+ };
733
751
  /**
734
752
  * @private
735
753
  * @param {?} setting
@@ -741,7 +759,7 @@
741
759
  * @return {?}
742
760
  */
743
761
  function (setting) {
744
- window.localStorage.setItem(setting.id, JSON.stringify(setting));
762
+ localStorage.setItem(setting.id, JSON.stringify(setting));
745
763
  };
746
764
  /**
747
765
  * @private
@@ -754,7 +772,7 @@
754
772
  * @return {?}
755
773
  */
756
774
  function (setting) {
757
- window.sessionStorage.setItem(setting.id, JSON.stringify(setting));
775
+ sessionStorage.setItem(setting.id, JSON.stringify(setting));
758
776
  };
759
777
  /**
760
778
  * @private
@@ -863,6 +881,7 @@
863
881
  this.filterService = filterService;
864
882
  this.fb = fb;
865
883
  this.submitted = false;
884
+ this.previousSelectedNestedCheckbox = [];
866
885
  }
867
886
  Object.defineProperty(GenericFilterComponent.prototype, "config", {
868
887
  get: /**
@@ -917,10 +936,10 @@
917
936
  function (field) {
918
937
  /** @type {?} */
919
938
  var validators = [];
920
- if (field && field.minSelected) {
939
+ if (field && field.minSelected > 0) {
921
940
  validators.push(minSelectedValidator(field.minSelected));
922
941
  }
923
- if (field && field.maxSelected) {
942
+ if (field && field.maxSelected > 0) {
924
943
  validators.push(maxSelectedValidator(field.maxSelected));
925
944
  }
926
945
  return validators;
@@ -941,6 +960,15 @@
941
960
  this.formSub = this.form.valueChanges.subscribe(( /**
942
961
  * @return {?}
943
962
  */function () { return _this.submitted = false; }));
963
+ this.filterSkillsByServices(null, this.config);
964
+ /** @type {?} */
965
+ var services = this.config.fields.find(( /**
966
+ * @param {?} field
967
+ * @return {?}
968
+ */function (field) { return field.name === 'user-services'; }));
969
+ if (services) {
970
+ this.startFilterSkillsByServices(this.form, services);
971
+ }
944
972
  };
945
973
  /**
946
974
  * @return {?}
@@ -1120,6 +1148,11 @@
1120
1148
  * @return {?}
1121
1149
  */
1122
1150
  function (field) {
1151
+ if (field.name === 'user-services') {
1152
+ /** @type {?} */
1153
+ var selectedServices = this.getSelectedValuesForFields(this.form.controls, field);
1154
+ this.filterSkillsByServices(selectedServices, this.config);
1155
+ }
1123
1156
  if (field.radioSelectionChange && typeof field.radioSelectionChange === 'string') {
1124
1157
  var _a = __read(field.enableCondition.split('='), 2), name_3 = _a[0], value = _a[1];
1125
1158
  this.form.get(name_3).patchValue(value);
@@ -1141,6 +1174,9 @@
1141
1174
  this.filterService.persist(settings, this.config.persistence);
1142
1175
  this.filterService.givenErrors.next(null);
1143
1176
  this.submitted = false;
1177
+ if (this.config.cancelButtonCallback) {
1178
+ this.config.cancelButtonCallback();
1179
+ }
1144
1180
  };
1145
1181
  /**
1146
1182
  * @param {?} values
@@ -1186,6 +1222,19 @@
1186
1222
  }
1187
1223
  }
1188
1224
  };
1225
+ /**
1226
+ * @param {?} field
1227
+ * @param {?} i
1228
+ * @return {?}
1229
+ */
1230
+ GenericFilterComponent.prototype.checkBoxChecked = /**
1231
+ * @param {?} field
1232
+ * @param {?} i
1233
+ * @return {?}
1234
+ */
1235
+ function (field, i) {
1236
+ return (( /** @type {?} */(this.form.get(field.name))))['controls'][i]['value'];
1237
+ };
1189
1238
  /**
1190
1239
  * @param {?} event
1191
1240
  * @param {?} form
@@ -1287,6 +1336,56 @@
1287
1336
  }
1288
1337
  }
1289
1338
  }
1339
+ if (field.name === 'user-services') {
1340
+ this.startFilterSkillsByServices(form, field);
1341
+ }
1342
+ else if (field.name === 'user-skills') {
1343
+ if (isChecked) {
1344
+ /** @type {?} */
1345
+ var selectedIndex = field.options.findIndex(( /**
1346
+ * @param {?} option
1347
+ * @return {?}
1348
+ */function (option) { return option.key === event.target.value; }));
1349
+ /** @type {?} */
1350
+ var selectedCheckbox = this.form.get('user-skills').value;
1351
+ selectedCheckbox[selectedIndex] = true;
1352
+ this.form.get('user-skills').setValue(selectedCheckbox);
1353
+ this.previousSelectedNestedCheckbox.push(event.target.value);
1354
+ }
1355
+ else {
1356
+ /** @type {?} */
1357
+ var index = this.previousSelectedNestedCheckbox.indexOf(event.target.value);
1358
+ if (index !== -1) {
1359
+ this.previousSelectedNestedCheckbox.splice(index, 1);
1360
+ }
1361
+ }
1362
+ }
1363
+ };
1364
+ /**
1365
+ * @private
1366
+ * @param {?} form
1367
+ * @param {?} field
1368
+ * @return {?}
1369
+ */
1370
+ GenericFilterComponent.prototype.startFilterSkillsByServices = /**
1371
+ * @private
1372
+ * @param {?} form
1373
+ * @param {?} field
1374
+ * @return {?}
1375
+ */
1376
+ function (form, field) {
1377
+ /** @type {?} */
1378
+ var servicesArray = [];
1379
+ form.value[field.name].map(( /**
1380
+ * @param {?} service
1381
+ * @param {?} index
1382
+ * @return {?}
1383
+ */function (service, index) {
1384
+ if (service) {
1385
+ servicesArray.push(field.options[index].key);
1386
+ }
1387
+ }));
1388
+ this.filterSkillsByServices(servicesArray, this.config);
1290
1389
  };
1291
1390
  /**
1292
1391
  * @private
@@ -1399,14 +1498,14 @@
1399
1498
  this.form.addControl('findPersonControl', findPersonControl);
1400
1499
  }
1401
1500
  var _loop_1 = function (field) {
1402
- if (field.type === 'checkbox' || field.type === 'checkbox-large') {
1501
+ if (field.type === 'checkbox' || field.type === 'checkbox-large' || field.type === 'nested-checkbox') {
1403
1502
  /** @type {?} */
1404
1503
  var formArray = this_1.buildCheckBoxFormArray(field, settings);
1405
1504
  this_1.form.addControl(field.name, formArray);
1406
1505
  }
1407
- else if (field.type === 'find-location') {
1506
+ else if (field.type === 'find-location' || field.type === 'find-service') {
1408
1507
  /** @type {?} */
1409
- var formArray = this_1.buildFindLocationFormArray(field, settings);
1508
+ var formArray = this_1.buildFormArray(field, settings);
1410
1509
  this_1.form.addControl(field.name, formArray);
1411
1510
  }
1412
1511
  else {
@@ -1417,6 +1516,9 @@
1417
1516
  if (field.type === 'text-input') {
1418
1517
  validators.push(forms.Validators.minLength(field.minSelected));
1419
1518
  }
1519
+ if (field.type === 'email-input') {
1520
+ validators.push(forms.Validators.email);
1521
+ }
1420
1522
  }
1421
1523
  /** @type {?} */
1422
1524
  var defaultValue = null;
@@ -1448,7 +1550,7 @@
1448
1550
  });
1449
1551
  this_1.form.addControl(field.name, formGroup);
1450
1552
  }
1451
- else {
1553
+ else if (field.type !== 'group-title') {
1452
1554
  /** @type {?} */
1453
1555
  var control = new forms.FormControl(defaultValue, validators);
1454
1556
  this_1.form.addControl(field.name, control);
@@ -1544,7 +1646,7 @@
1544
1646
  * @param {?} settings
1545
1647
  * @return {?}
1546
1648
  */
1547
- GenericFilterComponent.prototype.buildFindLocationFormArray = /**
1649
+ GenericFilterComponent.prototype.buildFormArray = /**
1548
1650
  * @private
1549
1651
  * @param {?} field
1550
1652
  * @param {?} settings
@@ -1646,8 +1748,8 @@
1646
1748
  if (formGroup && formGroup.errors && (formGroup.errors.minlength || formGroup.errors.required)) {
1647
1749
  errors.push({ name: field.name, error: field.minSelectedError });
1648
1750
  }
1649
- if (formGroup && formGroup.errors && formGroup.errors.maxLength) {
1650
- errors.push({ name: field.name, error: field.minSelectedError });
1751
+ if (formGroup && formGroup.errors && formGroup.errors.maxlength) {
1752
+ errors.push({ name: field.name, error: field.maxSelectedError });
1651
1753
  }
1652
1754
  }
1653
1755
  }
@@ -1664,17 +1766,200 @@
1664
1766
  throw e_8.error;
1665
1767
  }
1666
1768
  }
1769
+ // remove duplicates
1770
+ errors = errors.filter(( /**
1771
+ * @param {?} filterError
1772
+ * @param {?} i
1773
+ * @param {?} arr
1774
+ * @return {?}
1775
+ */function (filterError, i, arr) {
1776
+ return errors.indexOf(arr.find(( /**
1777
+ * @param {?} item
1778
+ * @return {?}
1779
+ */function (item) { return item.name === filterError.name; }))) === i;
1780
+ }));
1667
1781
  if (errors.length) {
1668
1782
  this.filterService.givenErrors.next(errors);
1669
1783
  }
1670
1784
  };
1785
+ /**
1786
+ * @param {?} services
1787
+ * @param {?} config
1788
+ * @return {?}
1789
+ */
1790
+ GenericFilterComponent.prototype.filterSkillsByServices = /**
1791
+ * @param {?} services
1792
+ * @param {?} config
1793
+ * @return {?}
1794
+ */
1795
+ function (services, config) {
1796
+ var _this = this;
1797
+ this.filteredSkillsByServices = [];
1798
+ this.filteredSkillsByServicesCheckbox = [];
1799
+ /** @type {?} */
1800
+ var userSkillsSelectField = config.fields.find(( /**
1801
+ * @param {?} f
1802
+ * @return {?}
1803
+ */function (f) { return f.name === 'user-skills' && f.type === 'group-select'; }));
1804
+ /** @type {?} */
1805
+ var userSkillsCheckboxField = config.fields.find(( /**
1806
+ * @param {?} f
1807
+ * @return {?}
1808
+ */function (f) { return f.name === 'user-skills' && f.type === 'nested-checkbox'; }));
1809
+ if (userSkillsSelectField) {
1810
+ /** @type {?} */
1811
+ var userSkills_1 = userSkillsSelectField.groupOptions;
1812
+ if (!services || services.length === 0) {
1813
+ this.filteredSkillsByServices = userSkills_1;
1814
+ }
1815
+ else {
1816
+ services.forEach(( /**
1817
+ * @param {?} s
1818
+ * @return {?}
1819
+ */function (s) {
1820
+ /** @type {?} */
1821
+ var groupOption = userSkills_1.find(( /**
1822
+ * @param {?} u
1823
+ * @return {?}
1824
+ */function (u) { return u.group.toLowerCase() === s.toLowerCase(); }));
1825
+ if (groupOption) {
1826
+ _this.filteredSkillsByServices.push(groupOption);
1827
+ }
1828
+ }));
1829
+ }
1830
+ }
1831
+ else if (userSkillsCheckboxField) {
1832
+ /** @type {?} */
1833
+ var userSkills_2 = userSkillsCheckboxField.groupOptions;
1834
+ if (!services || services.length === 0) {
1835
+ this.filteredSkillsByServices = userSkills_2;
1836
+ }
1837
+ else {
1838
+ services.forEach(( /**
1839
+ * @param {?} s
1840
+ * @return {?}
1841
+ */function (s) {
1842
+ /** @type {?} */
1843
+ var groupOption = userSkills_2.find(( /**
1844
+ * @param {?} u
1845
+ * @return {?}
1846
+ */function (u) { return u.group.toLowerCase() === s.toLowerCase(); }));
1847
+ if (groupOption) {
1848
+ _this.filteredSkillsByServices.push(groupOption);
1849
+ }
1850
+ }));
1851
+ this.filteredSkillsByServicesCheckbox = this.filteredSkillsByServices.map(( /**
1852
+ * @param {?} skill
1853
+ * @return {?}
1854
+ */function (skill) {
1855
+ return skill.options;
1856
+ })).reduce(( /**
1857
+ * @param {?} a
1858
+ * @param {?} b
1859
+ * @return {?}
1860
+ */function (a, b) {
1861
+ return a.concat(b);
1862
+ }), []);
1863
+ userSkillsCheckboxField.options = [];
1864
+ userSkillsCheckboxField.options = this.filteredSkillsByServicesCheckbox;
1865
+ (( /** @type {?} */(this.form.get('user-skills'))))['controls'] = this.filteredSkillsByServicesCheckbox.map(( /**
1866
+ * @return {?}
1867
+ */function () { return new forms.FormControl(); }));
1868
+ this.form.get('user-skills').setValue(this.filteredSkillsByServicesCheckbox.map(( /**
1869
+ * @param {?} skill
1870
+ * @return {?}
1871
+ */function (skill) {
1872
+ return _this.previousSelectedNestedCheckbox.includes(skill.key);
1873
+ })));
1874
+ return this.filteredSkillsByServicesCheckbox;
1875
+ }
1876
+ }
1877
+ this.filteredSkillsByServices = this.sortGroupOptions(this.filteredSkillsByServices);
1878
+ return this.filteredSkillsByServices;
1879
+ };
1880
+ /**
1881
+ * @private
1882
+ * @param {?} formValues
1883
+ * @param {?} field
1884
+ * @return {?}
1885
+ */
1886
+ GenericFilterComponent.prototype.getSelectedValuesForFields = /**
1887
+ * @private
1888
+ * @param {?} formValues
1889
+ * @param {?} field
1890
+ * @return {?}
1891
+ */
1892
+ function (formValues, field) {
1893
+ /** @type {?} */
1894
+ var selectedValues = [];
1895
+ Object.keys(formValues).map(( /**
1896
+ * @param {?} name
1897
+ * @return {?}
1898
+ */function (name) {
1899
+ /** @type {?} */
1900
+ var values = formValues[name].value;
1901
+ if (name === field.name) {
1902
+ values.forEach(( /**
1903
+ * @param {?} v
1904
+ * @return {?}
1905
+ */function (v) {
1906
+ selectedValues.push(v.key);
1907
+ }));
1908
+ }
1909
+ }));
1910
+ return selectedValues;
1911
+ };
1912
+ /**
1913
+ * @private
1914
+ * @param {?} groupOptions
1915
+ * @return {?}
1916
+ */
1917
+ GenericFilterComponent.prototype.sortGroupOptions = /**
1918
+ * @private
1919
+ * @param {?} groupOptions
1920
+ * @return {?}
1921
+ */
1922
+ function (groupOptions) {
1923
+ /** @type {?} */
1924
+ var sortedResults = [];
1925
+ /** @type {?} */
1926
+ var groups = groupOptions.map(( /**
1927
+ * @param {?} go
1928
+ * @return {?}
1929
+ */function (go) { return go.group; }));
1930
+ groups.sort().forEach(( /**
1931
+ * @param {?} g
1932
+ * @return {?}
1933
+ */function (g) {
1934
+ /** @type {?} */
1935
+ var options = groupOptions.find(( /**
1936
+ * @param {?} go
1937
+ * @return {?}
1938
+ */function (go) { return go.group === g; })).options;
1939
+ /** @type {?} */
1940
+ var sortedOptions = options.sort(( /**
1941
+ * @param {?} a
1942
+ * @param {?} b
1943
+ * @return {?}
1944
+ */function (a, b) {
1945
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
1946
+ }));
1947
+ /** @type {?} */
1948
+ var result = {
1949
+ group: g,
1950
+ options: sortedOptions
1951
+ };
1952
+ sortedResults.push(result);
1953
+ }));
1954
+ return sortedResults;
1955
+ };
1671
1956
  GenericFilterComponent.decorators = [
1672
1957
  { type: i0.Component, args: [{
1673
1958
  selector: 'xuilib-generic-filter',
1674
- 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?.required) || 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 || form.get(field.name).errors?.required)\">\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 (personFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location (locationFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [locationTitle]=\"field.locationTitle\"\n [enableAddLocationButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\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 <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [title]=\"field.title\"\n [enableAddServiceButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\n [selectedServices]=\"form.get(field.name)?.value\"\n [field]=\"field\"\n ></xuilib-find-service>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text-input'\">\n <input class=\"govuk-input\" type=\"text\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n />\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 *ngIf=\"config.showCancelFilterButton\"\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",
1959
+ 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 elevated-break\">\n <ng-container [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'group-title'\">\n <div [class]=\"field.titleClasses ? field.titleClasses: 'govuk-label govuk-label--m govuk-!-margin-bottom-4'\">\n {{ field.name | capitalize }}\n </div>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\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?.required) || form.get(field.name).errors?.maxlength || form.get(field.name).errors?.email)}\">\n\n <div *ngIf=\"field.title\" class=\"xui-generic-filter__field-title\">\n <h3 [class]=\"field.titleClasses ? field.titleClasses : 'govuk-heading-s'\" style=\"margin-bottom: 0!important\">\n {{field.title | capitalize}}\n </h3>\n\n <div *ngIf=\"field?.titleHint\" class=\"govuk-!-margin-left-2\">\n {{ field.titleHint }}\n </div>\n </div>\n\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.displayMinSelectedError && submitted && (form.get(field.name).errors?.minlength || form.get(field.name).errors?.required)\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxlength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.emailError && submitted && form.get(field.name).errors?.email\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.emailError}}\n </span>\n\n <div class=\"govuk-body\" [class.govuk-body--maxWidth480px]=\"field.maxWidth480px\" [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=\"'group-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 selected value=\"\">{{field.disabledText}}</option>\n <optgroup *ngFor = 'let grp of filteredSkillsByServices' label=\"{{grp.group | titlecase}}\">\n <option *ngFor = 'let item of grp.options' [value]=\"item.key\">{{item.label}}</option>\n </optgroup>\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=\"'nested-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 filteredSkillsByServicesCheckbox; 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 [checked]=\"checkBoxChecked(field, 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 (personFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location (locationFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [locationTitle]=\"field.locationTitle\"\n [enableAddLocationButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\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 <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [enableAddServiceButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [selectedServices]=\"form.get(field.name)?.value\"\n [services]=\"field.options\"\n [field]=\"field\"\n ></xuilib-find-service>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text-input'\">\n <input class=\"govuk-input\" type=\"text\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n [attr.maxlength]=\"field.maxlength ? field.maxlength : null\"\n />\n </ng-container>\n <ng-container *ngSwitchCase=\"'email-input'\">\n <input class=\"govuk-input\" type=\"email\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n />\n </ng-container>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m\"/>\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 *ngIf=\"config.showCancelFilterButton\"\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",
1675
1960
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1676
1961
  encapsulation: i0.ViewEncapsulation.None,
1677
- styles: [".contain-classes .elevated-break{margin-bottom:20px}@media (min-width:40.0625em){.contain-classes .elevated-break{margin-bottom:30px}}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-direction:column;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}.contain-classes .govuk-select{width:100%}"]
1962
+ styles: [".contain-classes .elevated-break{margin-bottom:20px}@media (min-width:40.0625em){.contain-classes .elevated-break{margin-bottom:30px}}.contain-classes .govuk-body--maxWidth480px{max-width:480px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-direction:column;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}.contain-classes .xui-generic-filter__field-title{display:flex;align-items:center;margin-bottom:10px}.contain-classes .govuk-select{width:100%}"]
1678
1963
  }] }
1679
1964
  ];
1680
1965
  /** @nocollapse */
@@ -3940,7 +4225,7 @@
3940
4225
 
3941
4226
  /**
3942
4227
  * @fileoverview added by tsickle
3943
- * Generated from: lib/services/session-storage/session-storage.service.ts
4228
+ * Generated from: lib/services/storage/session-storage/session-storage.service.ts
3944
4229
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3945
4230
  */
3946
4231
  var SessionStorageService = /** @class */ (function () {
@@ -4506,7 +4791,7 @@
4506
4791
  FindLocationComponent.decorators = [
4507
4792
  { type: i0.Component, args: [{
4508
4793
  selector: 'xuilib-find-location',
4509
- template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"locationTitle\">{{locationTitle}}</label>\n </div>\n\n <div class=\"search-location__input-container\">\n <exui-search-location class=\"search-location__input\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [bookingCheck]=\"field.bookingCheckType\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationInputChanged)=\"onInputChanged($event)\"\n (locationSelected)=\"onLocationSelected($event)\"\n (searchLocationChanged)=\"onSearchInputChanged()\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\" class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add\n </a>\n </div>\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.site_name }}\n </a>\n </li>\n </ul>\n</div>\n",
4794
+ template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"locationTitle\">{{locationTitle}}</label>\n </div>\n\n <div class=\"search-location__input-container\">\n <exui-search-location class=\"search-location__input\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [bookingCheck]=\"field.bookingCheckType\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationInputChanged)=\"onInputChanged($event)\"\n (locationSelected)=\"onLocationSelected($event)\"\n (searchLocationChanged)=\"onSearchInputChanged()\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\"\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\"\n *ngIf=\"enableAddLocationButton\">\n Add\n </a>\n </div>\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.site_name }}\n </a>\n </li>\n </ul>\n</div>\n",
4510
4795
  styles: [".search-location__input-container{display:flex}.search-location .auto-complete-container{min-width:unset;width:calc(100% - 4px)}.search-location__input{flex:1 0 auto}.search-location .govuk-button--secondary{background-color:#ddd}"]
4511
4796
  }] }
4512
4797
  ];
@@ -5216,15 +5501,27 @@
5216
5501
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5217
5502
  */
5218
5503
  var FindServiceComponent = /** @class */ (function () {
5219
- function FindServiceComponent(fb) {
5220
- this.fb = fb;
5221
- this.serviceTitle = 'Search for a service by name';
5504
+ function FindServiceComponent() {
5505
+ this.services = [];
5506
+ this.selectedServices = [];
5222
5507
  this.enableAddServiceButton = true;
5223
- this.disableInputField = false;
5224
- this.form = this.fb.group({
5225
- searchTerm: ['']
5226
- });
5508
+ this.disabled = false;
5509
+ this.serviceFieldChanged = new i0.EventEmitter();
5510
+ this.tempSelectedService = null;
5227
5511
  }
5512
+ /**
5513
+ * @return {?}
5514
+ */
5515
+ FindServiceComponent.prototype.ngOnInit = /**
5516
+ * @return {?}
5517
+ */
5518
+ function () {
5519
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter(( /**
5520
+ * @param {?} service
5521
+ * @return {?}
5522
+ */function (service) { return service.key; })) : [];
5523
+ this.SortAnOptions();
5524
+ };
5228
5525
  /**
5229
5526
  * @return {?}
5230
5527
  */
@@ -5232,21 +5529,150 @@
5232
5529
  * @return {?}
5233
5530
  */
5234
5531
  function () {
5235
- // Todo
5532
+ var _this = this;
5533
+ if (this.tempSelectedService === null) {
5534
+ return;
5535
+ }
5536
+ this.selectedServices = __spread(this.selectedServices, [this.tempSelectedService]);
5537
+ this.addSelectedServicesToForm([this.tempSelectedService]);
5538
+ this.services = this.services.filter(( /**
5539
+ * @param {?} s
5540
+ * @return {?}
5541
+ */function (s) { return s.key !== _this.tempSelectedService.key; }));
5542
+ this.tempSelectedService = null;
5543
+ this.serviceFieldChanged.emit();
5544
+ };
5545
+ /**
5546
+ * @param {?} service
5547
+ * @return {?}
5548
+ */
5549
+ FindServiceComponent.prototype.removeService = /**
5550
+ * @param {?} service
5551
+ * @return {?}
5552
+ */
5553
+ function (service) {
5554
+ if (service.key) {
5555
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter(( /**
5556
+ * @param {?} selectedService
5557
+ * @return {?}
5558
+ */function (selectedService) { return selectedService.key !== service.key; })) : [];
5559
+ /** @type {?} */
5560
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5561
+ /** @type {?} */
5562
+ var index = (formArray.value).findIndex(( /**
5563
+ * @param {?} selectedService
5564
+ * @return {?}
5565
+ */function (selectedService) { return selectedService.key === service.key; }));
5566
+ if (index > -1) {
5567
+ formArray.removeAt(index);
5568
+ this.services.splice(index, 0, service);
5569
+ this.SortAnOptions();
5570
+ }
5571
+ this.serviceFieldChanged.emit();
5572
+ }
5573
+ };
5574
+ /**
5575
+ * @param {?} service
5576
+ * @return {?}
5577
+ */
5578
+ FindServiceComponent.prototype.onServiceSelected = /**
5579
+ * @param {?} service
5580
+ * @return {?}
5581
+ */
5582
+ function (service) {
5583
+ if (!service) {
5584
+ this.tempSelectedService = null;
5585
+ return;
5586
+ }
5587
+ if (this.field.maxSelected === 1) {
5588
+ this.removeSelectedValues();
5589
+ this.addSelectedServicesToForm([service]);
5590
+ }
5591
+ else {
5592
+ if (!this.selectedServices.find(( /**
5593
+ * @param {?} s
5594
+ * @return {?}
5595
+ */function (s) { return s.key === service.key; }))) {
5596
+ if (service.key) {
5597
+ this.tempSelectedService = service;
5598
+ }
5599
+ }
5600
+ }
5601
+ };
5602
+ /**
5603
+ * @private
5604
+ * @return {?}
5605
+ */
5606
+ FindServiceComponent.prototype.removeSelectedValues = /**
5607
+ * @private
5608
+ * @return {?}
5609
+ */
5610
+ function () {
5611
+ /** @type {?} */
5612
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5613
+ for (var i = 0; i < formArray.length; i++) {
5614
+ formArray.removeAt(i);
5615
+ }
5616
+ this.selectedServices = [];
5617
+ };
5618
+ /**
5619
+ * @private
5620
+ * @param {?} services
5621
+ * @return {?}
5622
+ */
5623
+ FindServiceComponent.prototype.addSelectedServicesToForm = /**
5624
+ * @private
5625
+ * @param {?} services
5626
+ * @return {?}
5627
+ */
5628
+ function (services) {
5629
+ var e_1, _a;
5630
+ /** @type {?} */
5631
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5632
+ try {
5633
+ for (var services_1 = __values(services), services_1_1 = services_1.next(); !services_1_1.done; services_1_1 = services_1.next()) {
5634
+ var service = services_1_1.value;
5635
+ formArray.push(new forms.FormControl(service));
5636
+ }
5637
+ }
5638
+ catch (e_1_1) {
5639
+ e_1 = { error: e_1_1 };
5640
+ }
5641
+ finally {
5642
+ try {
5643
+ if (services_1_1 && !services_1_1.done && (_a = services_1.return))
5644
+ _a.call(services_1);
5645
+ }
5646
+ finally {
5647
+ if (e_1)
5648
+ throw e_1.error;
5649
+ }
5650
+ }
5651
+ };
5652
+ /**
5653
+ * @private
5654
+ * @return {?}
5655
+ */
5656
+ FindServiceComponent.prototype.SortAnOptions = /**
5657
+ * @private
5658
+ * @return {?}
5659
+ */
5660
+ function () {
5661
+ return this.services.sort(( /**
5662
+ * @param {?} a
5663
+ * @param {?} b
5664
+ * @return {?}
5665
+ */function (a, b) {
5666
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
5667
+ }));
5236
5668
  };
5237
5669
  FindServiceComponent.decorators = [
5238
5670
  { type: i0.Component, args: [{
5239
5671
  selector: 'xuilib-find-service',
5240
- template: "<div class=\"service-picker-custom\">\n <div class=\"search-service\">\n <div class=\"govuk-body\">\n <label id=\"input-selected-service-label\" *ngIf=\"serviceTitle\">{{serviceTitle}}</label>\n </div>\n <div class=\"search-service__input-container\">\n <exui-search-service class=\"search-service__input\"\n [services]=\"services\"\n [selectedServices]=\"selectedServices\"\n [delay]=\"300\"\n [disabled]=\"disabled\"></exui-search-service>\n <a href=\"javascript:void(0)\" (click)=\"addService()\" class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n data-module=\"govuk-button\" *ngIf=\"enableAddServiceButton\" id=\"add-service\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"service-selection\" *ngFor=\"let selection of selectedServices\">\n <a class=\"hmcts-filter__tag\" href=\"javascript:void(0)\">\n {{ selection.name }}\n </a>\n </li>\n </ul>\n</div>\n",
5672
+ template: "<div class=\"service-picker-custom\">\n <div class=\"search-service\">\n <div class=\"govuk-body\">\n <label id=\"selectServiceSearch-label\" for=\"serviceSearch__select\" *ngIf=\"serviceTitle\">\n {{ serviceTitle}}\n </label>\n </div>\n <div class=\"search-service__input-container\">\n <exui-search-service class=\"search-service__input\" [services]=\"services\"\n (serviceChanged)=\"onServiceSelected($event)\">\n </exui-search-service>\n <a href=\"javascript:void(0)\" (click)=\"addService()\"\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\"\n *ngIf=\"enableAddServiceButton\" id=\"add-service\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedServices\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeService(selection)\" href=\"javascript:void(0)\">\n {{ selection.label }}\n </a>\n </li>\n </ul>\n</div>",
5241
5673
  styles: ["#add-service{background-color:#ddd}.search-service__input-container{display:flex}.search-service__input{flex:1 0 auto}"]
5242
5674
  }] }
5243
5675
  ];
5244
- /** @nocollapse */
5245
- FindServiceComponent.ctorParameters = function () {
5246
- return [
5247
- { type: forms.FormBuilder }
5248
- ];
5249
- };
5250
5676
  FindServiceComponent.propDecorators = {
5251
5677
  field: [{ type: i0.Input }],
5252
5678
  fields: [{ type: i0.Input }],
@@ -5254,9 +5680,9 @@
5254
5680
  form: [{ type: i0.Input }],
5255
5681
  services: [{ type: i0.Input }],
5256
5682
  selectedServices: [{ type: i0.Input }],
5257
- disabled: [{ type: i0.Input }],
5258
5683
  enableAddServiceButton: [{ type: i0.Input }],
5259
- disableInputField: [{ type: i0.Input }]
5684
+ disabled: [{ type: i0.Input }],
5685
+ serviceFieldChanged: [{ type: i0.Output }]
5260
5686
  };
5261
5687
  return FindServiceComponent;
5262
5688
  }());
@@ -5507,42 +5933,35 @@
5507
5933
  */
5508
5934
  var SearchServiceComponent = /** @class */ (function () {
5509
5935
  function SearchServiceComponent() {
5510
- this.showAutocomplete = false;
5511
- this.minSearchCharacters = 3;
5512
- this.term = '';
5936
+ this.services = [];
5937
+ this.serviceChanged = new i0.EventEmitter();
5513
5938
  }
5514
5939
  /**
5940
+ * @param {?} key
5515
5941
  * @return {?}
5516
5942
  */
5517
- SearchServiceComponent.prototype.onInput = /**
5518
- * @return {?}
5519
- */
5520
- function () {
5521
- // Todo
5522
- };
5523
- /**
5524
- * @return {?}
5525
- */
5526
- SearchServiceComponent.prototype.onSelectionChange = /**
5943
+ SearchServiceComponent.prototype.onSelectionChanged = /**
5944
+ * @param {?} key
5527
5945
  * @return {?}
5528
5946
  */
5529
- function () {
5530
- // Todo
5947
+ function (key) {
5948
+ /** @type {?} */
5949
+ var selectedService = this.services.find(( /**
5950
+ * @param {?} s
5951
+ * @return {?}
5952
+ */function (s) { return s.key === key; }));
5953
+ this.serviceChanged.emit(selectedService);
5531
5954
  };
5532
5955
  SearchServiceComponent.decorators = [
5533
5956
  { type: i0.Component, args: [{
5534
5957
  selector: 'exui-search-service',
5535
- template: "<div class=\"auto-complete-container\">\n <input\n id=\"inputServiceSearch\"\n (input)=\"onInput()\"\n [formControl]=\"form?.controls?.searchTerm\"\n [matAutocomplete]=\"autoSearchService\"\n class=\"govuk-input\"\n [attr.disabled]=\"disabled\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchService=\"matAutocomplete\">\n <mat-option *ngFor=\"let service of services\" (onSelectionChange)=\"onSelectionChange()\">\n {{ service.name }}\n </mat-option>\n <mat-option *ngIf=\"!services?.length && showAutocomplete && term && term.length >= this.minSearchCharacters\">No results found</mat-option>\n </mat-autocomplete>\n</div>\n",
5958
+ template: "<div class=\"govuk-form-group\">\n <select id=\"serviceSearch__select\" class=\"govuk-select\" name=\"serviceSearch__select\"\n (change)=\"onSelectionChanged($event.target.value)\">\n <option [value]=\"null\">All</option>\n <option *ngFor=\"let service of services\" [value]=\"service.key\">\n {{ service.label }}\n </option>\n </select>\n</div>",
5536
5959
  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: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{width:calc(100% - 4px);display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
5537
5960
  }] }
5538
5961
  ];
5539
5962
  SearchServiceComponent.propDecorators = {
5540
5963
  services: [{ type: i0.Input }],
5541
- selectedServices: [{ type: i0.Input }],
5542
- disabled: [{ type: i0.Input }],
5543
- delay: [{ type: i0.Input }],
5544
- form: [{ type: i0.Input }],
5545
- showAutocomplete: [{ type: i0.Input }]
5964
+ serviceChanged: [{ type: i0.Output }]
5546
5965
  };
5547
5966
  return SearchServiceComponent;
5548
5967
  }());
@@ -6905,6 +7324,33 @@
6905
7324
  return RemoveHostDirective;
6906
7325
  }());
6907
7326
 
7327
+ /**
7328
+ * @fileoverview added by tsickle
7329
+ * Generated from: lib/pipes/capitalize.pipe.ts
7330
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7331
+ */
7332
+ var CapitalizePipe = /** @class */ (function () {
7333
+ function CapitalizePipe() {
7334
+ }
7335
+ /**
7336
+ * @param {?} value
7337
+ * @return {?}
7338
+ */
7339
+ CapitalizePipe.prototype.transform = /**
7340
+ * @param {?} value
7341
+ * @return {?}
7342
+ */
7343
+ function (value) {
7344
+ /** @type {?} */
7345
+ var lowerCaseString = value.toLowerCase();
7346
+ return lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1);
7347
+ };
7348
+ CapitalizePipe.decorators = [
7349
+ { type: i0.Pipe, args: [{ name: 'capitalize' },] }
7350
+ ];
7351
+ return CapitalizePipe;
7352
+ }());
7353
+
6908
7354
  /**
6909
7355
  * @fileoverview added by tsickle
6910
7356
  * Generated from: lib/exui-common-lib.module.ts
@@ -6974,13 +7420,17 @@
6974
7420
  GovUkFileUploadComponent,
6975
7421
  RemoveHostDirective
6976
7422
  ];
7423
+ /** @type {?} */
7424
+ var pipes = [
7425
+ CapitalizePipe
7426
+ ];
6977
7427
  var ɵ0 = windowProvider;
6978
7428
  var ExuiCommonLibModule = /** @class */ (function () {
6979
7429
  function ExuiCommonLibModule() {
6980
7430
  }
6981
7431
  ExuiCommonLibModule.decorators = [
6982
7432
  { type: i0.NgModule, args: [{
6983
- declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS),
7433
+ declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, pipes),
6984
7434
  imports: [
6985
7435
  i4.CommonModule,
6986
7436
  forms.FormsModule,
@@ -6996,7 +7446,7 @@
6996
7446
  ],
6997
7447
  exports: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, [
6998
7448
  ngxPagination.PaginatePipe
6999
- ])
7449
+ ], pipes)
7000
7450
  },] }
7001
7451
  ];
7002
7452
  return ExuiCommonLibModule;
@@ -8126,6 +8576,7 @@
8126
8576
  exports.ɵbv = HmctsPrimaryNavigationComponent;
8127
8577
  exports.ɵbu = HmctsSubNavigationComponent;
8128
8578
  exports.ɵcn = RemoveHostDirective;
8579
+ exports.ɵco = CapitalizePipe;
8129
8580
  exports.ɵr = CaseSharingStateService;
8130
8581
  exports.ɵbg = CookieService;
8131
8582
  exports.ɵh = FeatureToggleService;