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