6a0c67b17807ff04c05d839dbcc1a4aad6e97c6e
[working/Evergreen.git] / Open-ILS / src / templates / conify / global / config / org_unit_proximity_adjustment.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = l('Org Unit Proximity Adjustments') %]
3 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
4     <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
5         <div>[% ctx.page_title %]</div>
6         <div>
7             <button dojoType="dijit.form.Button"
8                 onClick="aoupa_grid.showCreateDialog()">[% l('New OU Proximity Adjustment') %]</button>
9             <button dojoType="dijit.form.Button"
10                 onClick="aoupa_grid.deleteSelected()">[% l('Delete Selected') %]</button>
11         </div>
12     </div>
13     <div>
14         [% l('Show adjustments involving this branch or deeper:') %]
15         <select dojoType="openils.widget.OrgUnitFilteringSelect"
16             jsId="context_org_selector"></select>
17     </div>
18     <table jsId="aoupa_grid"
19         dojoType="openils.widget.AutoGrid"
20         query="{id: '*'}"
21         fmClass="aoupa"
22         fieldorder="['item_circ_lib','item_owning_lib','hold_pickup_lib','hold_request_lib','copy_location','circ_mod','pos','absolute_adjustment','prox_adjustment']"
23         showPaginator="true"
24         editOnEnter="true">
25         <thead>
26             <tr>
27                 <th field="item_circ_lib"
28                     get="openils.widget.AutoGrid.orgUnitGetter"></th>
29                 <th field="item_owning_lib"
30                     get="openils.widget.AutoGrid.orgUnitGetter"></th>
31                 <th field="hold_pickup_lib"
32                     get="openils.widget.AutoGrid.orgUnitGetter"></th>
33                 <th field="hold_request_lib"
34                     get="openils.widget.AutoGrid.orgUnitGetter"></th>
35             </tr>
36         </thead>
37     </table>
38 </div>
39
40 <script type="text/javascript">
41     dojo.require("openils.widget.AutoGrid");
42     dojo.require("openils.widget.OrgUnitFilteringSelect");
43
44     var context_org;
45
46     function load_grid(search) {
47         if (!search) search = {"id": {"!=": null}};
48
49         aoupa_grid.loadAll({
50             "order_by": {
51                 "aoupa": ["item_circ_lib","item_owning_lib","hold_pickup_lib","hold_request_lib","pos"]
52             }
53         }, search);
54     }
55
56     function reload_grid_from_ou_selector() {
57         context_org = context_org_selector.attr("value");
58         var descendants = aou.descendantNodeList(context_org, true);
59         aoupa_grid.resetStore();
60         load_grid({
61             "-or": [
62                 {"item_circ_lib": descendants},
63                 {"item_owning_lib": descendants},
64                 {"hold_pickup_lib": descendants},
65                 {"hold_request_lib": descendants}
66             ]
67         });
68     }
69
70     openils.Util.addOnLoad(
71         function() {
72             new openils.User().buildPermOrgSelector(
73                 "ADMIN_PROXIMITY_ADJUSTMENT",
74                 context_org_selector,
75                 null,
76                 function() {
77                     context_org_selector.onChange =
78                         reload_grid_from_ou_selector;
79                     reload_grid_from_ou_selector();
80                 }
81             );
82         }
83     );
84 </script>
85 [% END %]