LP1929741 Combobox idl auto query filter addition
authorBill Erickson <berickxx@gmail.com>
Fri, 4 Dec 2020 20:39:33 +0000 (15:39 -0500)
committerJane Sandberg <js7389@princeton.edu>
Sun, 2 Oct 2022 15:02:49 +0000 (08:02 -0700)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index a365c7e..dd46395 100644 (file)
@@ -107,6 +107,10 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
     @Input() idlBaseQuery: any = null;
     @Input() startIdFiresOnChange: boolean;
 
+    // This will be appended to the async data retrieval query
+    // when fetching objects by idlClass.
+    @Input() idlQueryAnd: {[field: string]: any};
+
     // Allow the selected entry ID to be passed via the template
     // This does NOT not emit onChange events.
     @Input() set selectedId(id: any) {
@@ -263,6 +267,9 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 }
                 const extra_args = { order_by : {} };
                 args[field] = {'ilike': `%${term}%`}; // could -or search on label
+                if (this.idlQueryAnd) {
+                    Object.assign(args, this.idlQueryAnd);
+                }
                 extra_args['order_by'][this.idlClass] = field;
                 extra_args['limit'] = 100;
                 if (this.idlIncludeLibraryInLabel) {