use built-in edit dialog
[working/Evergreen.git] / Open-ILS / web / templates / default / conify / global / acq / exchange_rate.tt2
1 [% WRAPPER default/base.tt2 %]
2 <!--
3 <script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/billing_type.js'> </script>
4 -->
5 <h1>Exchange Rates</h1><br/>
6
7 <script>
8     dojo.require('dojo.data.ItemFileWriteStore');
9     dojo.require('openils.widget.EditDialog');
10     dojo.require('openils.widget.AutoGrid');
11     dojo.require('openils.PermaCrud');
12     dojo.require('openils.Util');
13     dojo.require('dojox.grid.DataGrid');
14
15     var cache = {};
16     function renderGrid() {
17         erGrid.storeItemObjectMapper = function(item) { return cache[item.id]; };
18         var pcrud = new openils.PermaCrud();
19         pcrud.retrieveAll('acqexr', 
20             {   async : true,
21                 oncomplete : function(r) {
22                     var list = openils.Util.readResponse(r);
23                     erGrid.fmObjectList = list;
24                     for(var i in list) {
25                         cache[list[i].id()] = list[i];
26                         erGrid.store.newItem(list[i].toStoreItem());
27                     }
28                     erGrid.update();
29                 }
30             }
31         );
32     }
33     openils.Util.addOnLoad(renderGrid);
34 </script>
35
36 <div dojoType="dijit.layout.ContentPane" layoutAlign="top" style='height:600px;'>
37     <table jsId="erGrid" dojoType="openils.widget.AutoGrid" class='editable-auto-grid'
38             fieldOrder="['id', 'from_currency', 'to_currency', 'ratio']"
39             query="{id: '*'}" rowSelector='20px' fmClass='acqexr' editOnEnter='true'>
40     </table>
41 </div>
42 [% END %]
43
44