]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2
moved to 1.2-style dojo grid
[working/Evergreen.git] / Open-ILS / web / templates / default / acq / financial / list_funding_sources.tt2
1 [% WRAPPER 'default/base.tt2' %]
2 <div id='oils-acq-list-header' class='container'>
3     <div id='oils-acq-list-header-label'>Funding Sources</div>
4 </div>
5
6 <!-- load the page-specific JS -->
7 <script src='[% ctx.media_prefix %]/js/ui/default/acq/financial/list_funding_sources.js'> </script>
8
9 <script type="text/javascript">
10     function createFS(fields) {
11         /** Creates a new funding source */
12         openils.acq.FundingSource.create(
13             fields, 
14             function(fsId) {
15                 var evt = openils.Event.parse(fsId);
16                 if(evt) {
17                     alert(evt); /* XXX */
18                     return;
19                 } else {
20                     location.href =  /* go to the details page for this fs */
21                         '[% ctx.base_uri %]/acq/funding_source/view/'+fsId;
22                 }
23             }
24         );
25     }
26 </script>
27
28 <div class='oils-acq-actions-div'>
29     <div dojoType="dijit.form.DropDownButton">
30         <span>New Funding Source</span>
31
32         <div dojoType="dijit.TooltipDialog" execute="createFS(arguments[0]);">
33             <script type='dojo/connect' event='onOpen'>
34                 openils.acq.CurrencyType.loadSelectWidget(fsCurrencySelector);
35                 new openils.User().buildPermOrgSelector('ADMIN_FUNDING_SOURCE', fsOwnerSelect);
36             </script>
37
38             <table class='dijitTooltipTable'>
39                 <tr>
40                     <td><label for="name">Name: </label></td>
41                     <td><input dojoType="dijit.form.TextBox" name="name"/></td>
42                 </tr>
43                 <tr>
44                     <td><label for="name">Code: </label></td>
45                     <td><input dojoType="dijit.form.TextBox" name="code"/></td>
46                 </tr>
47                 <tr>
48                     <td><label for="currency_type">Currency Type:</label></td>
49                     <td>
50                         <input jsId='fsCurrencySelector' name="currency_type" 
51                             dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
52                         </input>
53                     </td>
54                 </tr>
55                 <tr>
56                     <td valign='top'><label for="owner">Owning Location:</label></td>
57                     <td>
58                         <input dojoType="openils.widget.OrgUnitFilteringSelect" jsId='fsOwnerSelect'
59                             searchAttr="shortname" name="owner" autocomplete="true" labelAttr='shortname'> </input>
60                     </td>
61                 </tr>
62                 <tr>
63                     <td colspan='2' align='center'>
64                         <button dojoType=dijit.form.Button type="submit">Create</button>
65                     </td>
66                 </tr>
67             </table>
68         </div>
69     </div> 
70
71     <button dojoType="dijit.form.Button" 
72             onclick="openils.acq.FundingSource.deleteFromGrid(
73                 fundingSourceListGrid, function(){location.href = location.href})">
74         Delete Selected
75     </button>
76 </div>
77
78 <!-- The main grid lives here -->
79 <script>
80     function getName(rowIndex, item) {
81         if(!item) return '';
82         var name = this.grid.store.getValue(item, 'name');        
83         var id = this.grid.store.getValue(item, 'id');
84         return '<a href="[% ctx.base_uri %]/acq/funding_source/view/'+id+'">'+name+'</a>';
85     }
86 </script>
87 <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
88      <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
89          <table jsId="fundingSourceListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
90             <thead> 
91                 <tr> 
92                     <th field="id">ID</th> 
93                     <th field="name" width='auto' get='getName'>Name</th> 
94                     <th field="owner" width='auto'get='getOrgInfo'>Owner</th> 
95                     <th field="code" width='auto'>Code</th>
96                     <th field="currency_type" width='auto'>Currency Type</th> 
97                     <th field="balance" width='auto' get='getBalanceInfo'>Balance</th> 
98                 </tr> 
99             </thead> 
100         </table>     
101     </div> 
102 </div> 
103  
104 [% END %]