]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2
JS reordering to account for readyState event leakage from XHR to the main page
[working/Evergreen.git] / Open-ILS / web / templates / default / conify / global / acq / distribution_formula.tt2
1 [% WRAPPER default/base.tt2 %]
2 [% ctx.page_title = 'Distribution Formulas' %]
3
4 <div id='formula-list-div'>
5     <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
6         <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
7             <div>Distribution Formulas</div>
8             <div>
9                 <button dojoType='dijit.form.Button' onClick='fListGrid.showCreateDialog()'>New Formula</button>
10                 <button dojoType='dijit.form.Button' onClick='fListGrid.deleteSelected()'>Delete Selected</button>
11                 <button dojoType='dijit.form.Button' onClick='cloneSelectedFormula()'>Clone Selected</button>
12             </div>
13         </div>
14         <table  jsId="fListGrid"
15                 dojoType="openils.widget.AutoGrid"
16                 fieldOrder="['id', 'name', 'owner', 'item_count']"
17                 suppressFields="['skip_count']"
18                 query="{id: '*'}"
19                 defaultCellWidth='12'
20                 fmClass='acqdf'
21                 editOnEnter='true'>
22             <thead>
23                 <tr>
24                     <th field='name' get='getFormulaName' formatter='formatName'/>
25                     <th field='item_count' get='getItemCount'/>
26                 </tr>
27             </thead>
28         </table>
29     </div>
30 </div>
31
32
33 <div id='formula-entry-div'>
34     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
35         <div><a href='javascript:void(0);' id="formula_head"></a></div>
36         <div>
37         </div>
38     </div>
39     <br/>
40     <div>
41         <button dojoType='dijit.form.Button' onClick='addEntry()'>New Entry</button>
42         <span style='padding-right:20px;'></span>
43         <button dojoType='dijit.form.Button' onClick='saveFormula()'>Apply Changes</button>
44     </div>
45     <br/>
46     <table class='oils-generic-table'>
47         <thead>
48             <tr>
49                 <th></th>
50                 <th>Owning Library</th>
51                 <th>Shelving Location</th>
52                 <th>Item Count</th>
53                 <th></th>
54             </tr>
55         </thead>
56         <tbody id='formula-entry-tbody'>
57             <tr id='formula-entry-tempate'>
58                 <td><div name='delete' dojoType='dijit.form.Button' style='color:red;' scrollOnFocus='false'>X</div></td>
59                 <td><div name='owning_lib'></td>
60                 <td><div name='location'></td>
61                 <td><div name='item_count'></td>
62                 <td>
63                     <img src='[% ctx.media_prefix %]/images/dimple.png'/>
64                     <img src='[% ctx.media_prefix %]/images/dimple.png'/>
65                     <img src='[% ctx.media_prefix %]/images/dimple.png'/>
66                 <td>
67             </tr>
68         </tbody>
69     </table>
70     <br/>
71     <div>
72         <button dojoType='dijit.form.Button' onClick='addEntry()'>New Entry</button>
73         <span style='padding-right:20px;'></span>
74         <button dojoType='dijit.form.Button' onClick='saveFormula()'>Apply Changes</button>
75     </div>
76 </div>
77
78 <script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/conify/global/acq/distribution_formula.js'></script>
79
80 <script type="text/javascript"> 
81     var formulaId = '[% ctx.page_args.0 %]';
82
83     function getFormulaName(rowIndex, item) {
84         if(!item) return '';
85         var name = this.grid.store.getValue(item, 'name');
86         var id = this.grid.store.getValue(item, 'id');
87         return id + ':' + name;
88     }
89
90     function formatName(value) {
91         if(value) {
92             var vals = value.split(/:/);
93             return '<a href="'+location.href+ '/'+vals[0]+'">'+vals[1]+'</a>';
94         }
95     }
96 </script>
97
98 [% END %]
99