change input for Active? on search form to a tri-value select (LH#16)
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 9 Jul 2020 19:40:52 +0000 (15:40 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 9 Jul 2020 19:40:52 +0000 (15:40 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.html
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider-search-form.component.ts

index c7fa301..9b1317a 100644 (file)
     <div class="col-lg-2">
       <input i18n-placeholder placeholder="URL" [ngModelOptions]="{standalone: true}" [(ngModel)]="providerURL" type="text" class="form-control" />
     </div>
-    <div class="col-lg-2">
-      <input class="form-check-input" type="checkbox" id="acqproIsActive" [ngModelOptions]="{standalone: true}" [(ngModel)]="providerIsActive"/>
-      <label for="acqproIsActive" class="form-check-label" i18n>Active?</label>
+    <div class="col-lg-2 form-group">
+      <label for="acqproIsActive" i18n>Active?</label>
+      <select class="form-control" id="acqproIsActive" [ngModelOptions]="{standalone: true}" [(ngModel)]="providerIsActive">
+        <option i18n value="active">Yes</option>
+        <option i18n value="inactive">No</option>
+        <option i18n value="any">Any</option>
+      </select>
     </div>
   </div>
 </form>
index 5a255f8..04af1fc 100644 (file)
@@ -31,7 +31,7 @@ export class AcqProviderSearchFormComponent implements OnInit, AfterViewInit {
     providerSAN = '';
     providerEDIDefault = null;
     providerURL = '';
-    providerIsActive = true;
+    providerIsActive = 'active';
 
     constructor(
         private router: Router,
@@ -61,7 +61,7 @@ export class AcqProviderSearchFormComponent implements OnInit, AfterViewInit {
         this.providerSAN = '';
         this.providerEDIDefault = null;
         this.providerURL = '';
-        this.providerIsActive = true;
+        this.providerIsActive = 'active';
     }
 
     submitSearch() {
@@ -103,7 +103,16 @@ export class AcqProviderSearchFormComponent implements OnInit, AfterViewInit {
         if (this.providerURL) {
             searchTerms.push({ classes: ['acqpro'], fields: ['url'], op: 'ilike', value: this.providerURL });
         }
-        searchTerms.push({ classes: ['acqpro'], fields: ['active'], op: '=', value: (this.providerIsActive ? 't' : 'f') });
+        switch (this.providerIsActive) {
+            case 'active': {
+                searchTerms.push({ classes: ['acqpro'], fields: ['active'], op: '=', value: 't' });
+                break;
+            }
+            case 'inactive': {
+                searchTerms.push({ classes: ['acqpro'], fields: ['active'], op: '=', value: 'f' });
+                break;
+            }
+        }
 
         // tossing setTimeout here to ensure that the
         // grid data source is fully initialized