]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/acq/financial/list_funds.tt2
Merging acq-experiment to trunk, since rel_1_4 has been branched.
[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) {
90         data = fundListGrid.model.getRow(rowIndex);
91         if(!data) return;
92         return '<a href="[% ctx.base_uri %]/acq/fund/view/'+data.id+'">'+data.name+'</a>';
93     }
94
95     var fundListGridStructure = [{
96         cells : [[
97             {name: 'ID', field: 'id'},
98             {name: 'Name', width:'auto', get:getName}, 
99             {name: 'Code', field:'code'},
100             {name: 'Year', field: "year"}, 
101             {name: 'Location', get:getOrgInfo}, 
102             {name: 'Currency Type', field: "currency_type"},
103             {name: 'Combined Balance', get:getBalanceInfo}
104         ]]
105     }];
106 </script>
107 <div jsId='fundListGrid' dojoType="dojox.Grid" structure='fundListGridStructure'></div>
108 [% END %]
109