Angular Library Settings Editor Touch-up
authorKyle Huckins <khuckins@catalyte.io>
Mon, 16 Nov 2020 20:50:37 +0000 (20:50 +0000)
committerJane Sandberg <sandbergja@gmail.com>
Thu, 13 Oct 2022 16:04:00 +0000 (09:04 -0700)
- Remove case-sensitivity from Filter
- Ensure filter returns you to the beginning of the grid results when
  applying or clearing the filter.

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/org-unit-settings.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/org-unit-settings.component.ts

index 533c975..4352a5b 100644 (file)
@@ -1,5 +1,5 @@
-<eg-title i18n-prefix prefix="Org Unit Settings Editor"></eg-title>
-<eg-staff-banner bannerText="Org Unit Settings Config" i18n-bannerText></eg-staff-banner>
+<eg-title i18n-prefix prefix="Library Settings Editor"></eg-title>
+<eg-staff-banner bannerText="Library Settings Editor" i18n-bannerText></eg-staff-banner>
 <!-- org unit selector -->
 
 <eg-admin-edit-org-unit-setting-dialog #editOuSettingDialog>
@@ -28,6 +28,7 @@
             class="form-control"
             [(ngModel)]="filterString"
             (blur)="applyFilter()"
+                       (keydown.enter)="$event.target.blur()"
             aria-label="Filter Settings"
             i18n-aria-label
         />
index d0b1092..5c074c5 100644 (file)
@@ -9,6 +9,7 @@ import {NetService} from '@eg/core/net.service';
 import {GridDataSource} from '@eg/share/grid/grid';
 import {GridComponent} from '@eg/share/grid/grid.component';
 import {ToastService} from '@eg/share/toast/toast.service';
+import {LocaleService} from '@eg/core/locale.service';
 
 import {EditOuSettingDialogComponent
     } from '@eg/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component';
@@ -69,6 +70,7 @@ export class OrgUnitSettingsComponent implements OnInit {
         private pcrud: PcrudService,
         private auth: AuthService,
         private toast: ToastService,
+        private locale: LocaleService,
         private net: NetService,
     ) {
         this.gridDataSource = new GridDataSource();
@@ -221,6 +223,7 @@ export class OrgUnitSettingsComponent implements OnInit {
 
     applyFilter(clear?: boolean) {
         if (clear) { this.filterString = ''; }
+        this.orgUnitSettingsGrid.context.pager.toFirst()
         this.updateGrid(this.contextOrg);
     }
 
@@ -330,10 +333,14 @@ export class OrgUnitSettingsComponent implements OnInit {
                 const tempGrid = this.settingTypeArr;
                 tempGrid.forEach(row => {
                     const containsString =
-                         row.name.includes(this.filterString) ||
-                         row.label.includes(this.filterString) ||
-                         (row.grp && row.grp.includes(this.filterString)) ||
-                         (row.description && row.description.includes(this.filterString));
+                         row.name.toLocaleLowerCase(this.locale.currentLocaleCode())
+                                                   .includes(this.filterString.toLocaleLowerCase(this.locale.currentLocaleCode())) ||
+                         row.label.toLocaleLowerCase(this.locale.currentLocaleCode())
+                                                   .includes(this.filterString.toLocaleLowerCase(this.locale.currentLocaleCode())) ||
+                         (row.grp && row.grp.toLocaleLowerCase(this.locale.currentLocaleCode())
+                                                   .includes(this.filterString.toLocaleLowerCase(this.locale.currentLocaleCode()))) ||
+                         (row.description && row.description.toLocaleLowerCase(this.locale.currentLocaleCode())
+                                                    .includes(this.filterString.toLocaleLowerCase(this.locale.currentLocaleCode())));
                     if (containsString) {
                         this.gridDataSource.data.push(row);
                     }