LP#1701001: split patron search form into separate templates
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 28 Jul 2017 20:55:37 +0000 (16:55 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Mon, 14 Aug 2017 19:58:02 +0000 (15:58 -0400)
This patch breaks up the patron search form and results into
separate templates and adds a template for a patron selector
modal.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/src/templates/staff/circ/patron/t_search.tt2
Open-ILS/src/templates/staff/share/t_patron_search_form.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/share/t_patron_search_results.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/share/t_patron_selector.tt2 [new file with mode: 0644]

index 72e8336..c67291a 100644 (file)
@@ -1,154 +1,4 @@
-
-<!-- TODO: inputs need sr-only labels
-   <label class="sr-only" for="input-id">label</label>
--->
-
-<div class="row" id="patron-search-form-row">
-  <div class="col-md-11">
-    <form ng-submit="search(searchArgs)" id="patron-search-form" 
-        role="form" class="form-horizontal">
-
-      <div class="form-group">
-
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            focus-me="focusMe"
-            ng-model="searchArgs.family_name" placeholder="[% l('Last Name') %]"/>
-        </div>
-
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.first_given_name" placeholder="[% l('First Name') %]"/>
-        </div>
-
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.second_given_name" placeholder="[% l('Middle Name') %]"/>
-        </div>
-
-        <div class="col-md-2" ng-mouseover="setLastFormElement()">
-          <input type="submit" class="btn btn-primary" value="[% l('Search') %]"/>
-        </div>
-
-        <div class="col-md-2" ng-mouseover="setLastFormElement()">
-          <input type="reset" class="btn btn-primary" ng-click="clearForm()" 
-            value="[% l('Clear Form') %]"/>
-        </div>
-
-        <div class="col-md-2">
-          <button class="btn btn-default" ng-click="applyShowExtras($event, true)" 
-            ng-mouseover="setLastFormElement()"
-            title="[% l('Show More Fields') %]" ng-show="!showExtras">
-            <span class="glyphicon glyphicon-circle-arrow-down"></span>
-          </button>
-          <button class="btn btn-default" ng-click="applyShowExtras($event, false)" 
-            ng-mouseover="setLastFormElement()"
-            title="[% l('Show Fewer Fields') %]" ng-show="showExtras">
-            <span class="glyphicon glyphicon-circle-arrow-up"></span>
-          </button>
-        </div>
-      </div>
-
-      <div class="form-group" ng-show="showExtras">
-        <div class="col-md-2">
-          <input type="text" class="form-control" ng-model="searchArgs.card" 
-            placeholder="[% l('Barcode') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.alias" placeholder="[% l('Alias') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.usrname" placeholder="[% l('Username') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.email" placeholder="[% l('Email') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.ident" placeholder="[% l('Identification') %]"/>
-        </div>
-      </div>
-
-      <div class="form-group" ng-show="showExtras">
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.id" placeholder="[% l('Database ID') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.phone" placeholder="[% l('Phone') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.street1" placeholder="[% l('Street 1') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.street2" placeholder="[% l('Street 2') %]"/>
-        </div>
-        <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="searchArgs.city" placeholder="[% l('City') %]"/>
-        </div>
-      </div>
-
-      <div class="form-group" ng-show="showExtras">
-        <div class="col-md-2">
-          <input type="text" class="form-control" ng-model="searchArgs.state" 
-            placeholder="[% l('State') %]" title="[% l('State') %]"/>
-        </div>
-
-        <div class="col-md-2">
-          <input type="text" class="form-control" ng-model="searchArgs.post_code" 
-            placeholder="[% l('Post Code') %]" title="[% l('Post Code') %]"/>
-        </div>
-
-        <div class="col-md-2">
-          <!--
-          <input type="text" class="form-control"  
-            placeholder="[% l('Profile Group') %]"
-            ng-model="searchArgs.profile"
-            typeahead="grp as grp.name for grp in profiles | filter:$viewValue" 
-            typeahead-editable="false" />
-            -->
-
-            <div class="btn-group patron-search-selector" uib-dropdown>
-              <button type="button" class="btn btn-default" uib-dropdown-toggle>
-                <span style="padding-right: 5px;">{{searchArgs.profile.name() || "[% l('Profile Group') %]"}}</span>
-                <span class="caret"></span>
-              </button>
-              <ul uib-dropdown-menu>
-                <li ng-repeat="grp in profiles">
-                  <a href
-                    style="padding-left: {{pgt_depth(grp) * 10 + 5}}px"
-                    ng-click="searchArgs.profile = grp">{{grp.name()}}</a>
-                </li>
-              </ul>
-            </div>
-        </div>
-
-        <div class="col-md-2">
-          <eg-org-selector label="[% l('Home Library') %]" 
-            selected="searchArgs.home_ou" sticky-setting="eg.circ.patron.search.ou">
-          </eg-org-selector>
-        </div>
-
-        <div class="col-md-2">
-          <div class="checkbox">
-            <label>
-              <input type="checkbox" ng-model="searchArgs.inactive"/>
-              [% l('Include Inactive?') %]
-            </label>
-          </div>
-        </div>
-      </div>
-    </form>
-  </div>
-</div>
-
+[% INCLUDE 'staff/share/t_patron_search_form.tt2' %]
 
 <br/>
 <div class="row">
diff --git a/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2 b/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
new file mode 100644 (file)
index 0000000..49152d3
--- /dev/null
@@ -0,0 +1,150 @@
+
+<!-- TODO: inputs need sr-only labels
+   <label class="sr-only" for="input-id">label</label>
+-->
+
+<div class="row" id="patron-search-form-row">
+  <div class="col-md-11">
+    <form ng-submit="search(searchArgs)" id="patron-search-form" 
+        role="form" class="form-horizontal">
+
+      <div class="form-group">
+
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            focus-me="focusMe"
+            ng-model="searchArgs.family_name" placeholder="[% l('Last Name') %]"/>
+        </div>
+
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.first_given_name" placeholder="[% l('First Name') %]"/>
+        </div>
+
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.second_given_name" placeholder="[% l('Middle Name') %]"/>
+        </div>
+
+        <div class="col-md-2" ng-mouseover="setLastFormElement()">
+          <input type="submit" class="btn btn-primary" value="[% l('Search') %]"/>
+        </div>
+
+        <div class="col-md-2" ng-mouseover="setLastFormElement()">
+          <input type="reset" class="btn btn-primary" ng-click="clearForm()" 
+            value="[% l('Clear Form') %]"/>
+        </div>
+
+        <div class="col-md-2">
+          <button class="btn btn-default" ng-click="applyShowExtras($event, true)" 
+            ng-mouseover="setLastFormElement()"
+            title="[% l('Show More Fields') %]" ng-show="!showExtras">
+            <span class="glyphicon glyphicon-circle-arrow-down"></span>
+          </button>
+          <button class="btn btn-default" ng-click="applyShowExtras($event, false)" 
+            ng-mouseover="setLastFormElement()"
+            title="[% l('Show Fewer Fields') %]" ng-show="showExtras">
+            <span class="glyphicon glyphicon-circle-arrow-up"></span>
+          </button>
+        </div>
+      </div>
+
+      <div class="form-group" ng-show="showExtras">
+        <div class="col-md-2">
+          <input type="text" class="form-control" ng-model="searchArgs.card" 
+            placeholder="[% l('Barcode') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.alias" placeholder="[% l('Alias') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.usrname" placeholder="[% l('Username') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.email" placeholder="[% l('Email') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.ident" placeholder="[% l('Identification') %]"/>
+        </div>
+      </div>
+
+      <div class="form-group" ng-show="showExtras">
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.id" placeholder="[% l('Database ID') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.phone" placeholder="[% l('Phone') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.street1" placeholder="[% l('Street 1') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.street2" placeholder="[% l('Street 2') %]"/>
+        </div>
+        <div class="col-md-2">
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.city" placeholder="[% l('City') %]"/>
+        </div>
+      </div>
+
+      <div class="form-group" ng-show="showExtras">
+        <div class="col-md-2">
+          <input type="text" class="form-control" ng-model="searchArgs.state" 
+            placeholder="[% l('State') %]" title="[% l('State') %]"/>
+        </div>
+
+        <div class="col-md-2">
+          <input type="text" class="form-control" ng-model="searchArgs.post_code" 
+            placeholder="[% l('Post Code') %]" title="[% l('Post Code') %]"/>
+        </div>
+
+        <div class="col-md-2">
+          <!--
+          <input type="text" class="form-control"  
+            placeholder="[% l('Profile Group') %]"
+            ng-model="searchArgs.profile"
+            typeahead="grp as grp.name for grp in profiles | filter:$viewValue" 
+            typeahead-editable="false" />
+            -->
+
+            <div class="btn-group patron-search-selector" uib-dropdown>
+              <button type="button" class="btn btn-default" uib-dropdown-toggle>
+                <span style="padding-right: 5px;">{{searchArgs.profile.name() || "[% l('Profile Group') %]"}}</span>
+                <span class="caret"></span>
+              </button>
+              <ul uib-dropdown-menu>
+                <li ng-repeat="grp in profiles">
+                  <a href
+                    style="padding-left: {{pgt_depth(grp) * 10 + 5}}px"
+                    ng-click="searchArgs.profile = grp">{{grp.name()}}</a>
+                </li>
+              </ul>
+            </div>
+        </div>
+
+        <div class="col-md-2">
+          <eg-org-selector label="[% l('Home Library') %]" 
+            selected="searchArgs.home_ou" sticky-setting="eg.circ.patron.search.ou">
+          </eg-org-selector>
+        </div>
+
+        <div class="col-md-2">
+          <div class="checkbox">
+            <label>
+              <input type="checkbox" ng-model="searchArgs.inactive"/>
+              [% l('Include Inactive?') %]
+            </label>
+          </div>
+        </div>
+      </div>
+    </form>
+  </div>
+</div>
diff --git a/Open-ILS/src/templates/staff/share/t_patron_search_results.tt2 b/Open-ILS/src/templates/staff/share/t_patron_search_results.tt2
new file mode 100644 (file)
index 0000000..885aded
--- /dev/null
@@ -0,0 +1,35 @@
+
+<!-- patron search results grid -->
+<eg-grid
+  idl-class="au" id-field="id"
+  features="-sort,-display,-multisort,-multiselect"
+  main-label="[% l('Patron Search Results') %]"
+  grid-controls="gridControls"
+  items-provider="patronSearchGridProvider"
+  persist-key="circ.patron.search">
+
+  <eg-grid-field label="[% ('ID') %]" path='id' visible></eg-grid-field>
+  <eg-grid-field label="[% ('Card') %]" path='card.barcode' visible></eg-grid-field>
+  <eg-grid-field label="[% ('Profile') %]" path='profile.name' visible></eg-grid-field>
+  <eg-grid-field label="[% ('Last Name') %]" path='family_name' visible sortable multisortable></eg-grid-field>
+  <eg-grid-field label="[% ('First Name') %]" path='first_given_name' visible sortable multisortable></eg-grid-field>
+  <eg-grid-field label="[% ('Middle Name') %]" path='second_given_name' visible sortable multisortable></eg-grid-field>
+  <eg-grid-field label="[% ('DoB') %]" path='dob' visible sortable multisortable></eg-grid-field>
+  <eg-grid-field label="[% ('Home Library') %]" path='home_ou.shortname' visible></eg-grid-field>
+  <eg-grid-field label="[% ('Created On') %]" path='create_date' visible sortable multisortable></eg-grid-field>
+
+  <eg-grid-field label="[% ('Mailing:Street 1') %]" path='mailing_address.street1' visible></eg-grid-field>
+  <eg-grid-field label="[% ('Mailing:Street 2') %]" path='mailing_address.street2'></eg-grid-field>
+  <eg-grid-field label="[% ('Mailing:City') %]" path='mailing_address.city'></eg-grid-field>
+  <eg-grid-field label="[% ('Mailing:County') %]" path='mailing_address.county'></eg-grid-field>
+  <eg-grid-field label="[% ('Mailing:State') %]" path='mailing_address.state'></eg-grid-field>
+  <eg-grid-field label="[% ('Mailing:Zip') %]" path='mailing_address.post_code'></eg-grid-field>
+
+  <eg-grid-field label="[% ('Billing:Street 1') %]" path='billing_address.street1'></eg-grid-field>
+  <eg-grid-field label="[% ('Billing:Street 2') %]" path='billing_address.street2'></eg-grid-field>
+  <eg-grid-field label="[% ('Billing:City') %]" path='billing_address.city'></eg-grid-field>
+  <eg-grid-field label="[% ('Billing:County') %]" path='billing_address.county'></eg-grid-field>
+  <eg-grid-field label="[% ('Billing:State') %]" path='billing_address.state'></eg-grid-field>
+  <eg-grid-field label="[% ('Billing:Zip') %]" path='billing_address.post_code'></eg-grid-field>
+  <eg-grid-field path='*' ignore="id family_name first_given_name second_given_name dob create_date"></eg-grid-field>
+</eg-grid>
diff --git a/Open-ILS/src/templates/staff/share/t_patron_selector.tt2 b/Open-ILS/src/templates/staff/share/t_patron_selector.tt2
new file mode 100644 (file)
index 0000000..e67df41
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+  Patron selector dialog
+-->
+<div>
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title alert alert-info">[% l('Select Patron') %]</h4> 
+  </div>
+  <div class="modal-body">
+    [% INCLUDE 'staff/share/t_patron_search_form.tt2' %]
+    <br/>
+    <div class="row">
+      <div class="col-md-12">
+        [% INCLUDE 'staff/share/t_patron_search_results.tt2' %]
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    [% dialog_footer %]
+    <input type="submit" class="btn btn-primary" 
+      ng-click="ok()" value="{{ ok_button_label || '[% l("Select") %]'}}"
+      ng-disabled="need_one_selected()"/>
+    <button class="btn btn-warning" 
+      ng-click="cancel()">{{ cancel_button_label || "[% l('Cancel') %]"}}</button>
+  </div>
+</div>