b7be6ba3fe20081770589996a2c169aa81c1607b
[working/Evergreen.git] / Open-ILS / web / templates / default / acq / financial / view_funding_source.tt2
1 [% WRAPPER 'default/base.tt2' %]
2 <script>
3     var fundingSourceID = [% ctx.page_args.0 %];
4     function getFund(rowIndex) {
5         data = fsAllocationGrid.model.getRow(rowIndex);
6         if(data) {
7             var fund = openils.acq.Fund.retrieve(data.fund);
8             return '<a href="[% ctx.base_uri %]/acq/fund/view/'+fund.id()+'">'+fund.code()+'</a>';
9         }
10     }
11 </script>
12
13 <!-- load the page-specific JS -->
14 <script src='[% ctx.media_prefix %]/js/ui/default/acq/financial/view_funding_source.js'> </script>
15
16 <div id='oils-acq-list-header' class='container'>
17     <div id='oils-acq-list-header-label'>Funding Source Details</div>
18 </div>
19
20 <div class='oils-acq-actions-div' style='margin:8px;'> <!-- XXX CSS -->
21
22     <!-- Dropdown menu for creating a new funding source credit -->
23     <div dojoType="dijit.form.DropDownButton">
24         <span>Apply Credit</span>
25         <div dojoType="dijit.TooltipDialog" execute="applyFSCredit(arguments[0]);">
26             <table class='dijitTooltipTable'>
27                 <tr>
28                     <td><label for="amount">Amount: </label></td>
29                     <td>
30                         <!-- XXX get currency from funding source ... -->
31                         <input dojoType="dijit.form.CurrencyTextBox" name="amount" currency='USD'> </input>
32                     </td>
33                 </tr>
34                 <tr>
35                     <td><label for="note">Note: </label></td>
36                     <td>
37                         <input dojoType="dijit.form.TextBox" name="note"> </input>
38                         <!-- XXX textarea makes more sense, but it's buggy in the dropdown dialog .. perhaps a height issue?
39                         <textarea dojoType='dijit.form.Textarea' name="note" style='min-height:6em'> 
40                         </textarea>
41                         -->
42                     </td>
43                 </tr>
44                 <tr>
45                     <td colspan='2' align='center'>
46                         <button dojoType=dijit.form.Button type="submit">Apply</button>
47                     </td>
48                 </tr>
49             </table>
50         </div>
51     </div> 
52     <div dojoType="dijit.form.DropDownButton">
53         <span>Allocate to Fund</span>
54         <div dojoType="dijit.TooltipDialog" execute="applyFSAllocation(arguments[0]);">
55             <script type='dojo/connect' event='onOpen'>
56                 openils.acq.Fund.createStore(
57                     function(store) {
58                         fundingSourceFundSelector.store = 
59                             new dojo.data.ItemFileReadStore({data:store});
60                         fundingSourceFundSelector.setValue(store.items[0].code);
61                     }, 'MANAGE_FUND'
62                 );
63             </script>
64             <table class='dijitTooltipTable'>
65                 <tr>
66                     <td><label for="amount">Fund: </label></td>
67                     <td>
68                         <input jsId='fundingSourceFundSelector' name="fund" 
69                             dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
70                         </input>
71                     </td>
72                 </tr>
73                 <tr>
74                     <td><label for="amount">Amount: </label></td>
75                     <td>
76                         <!-- XXX get currency from funding source ... -->
77                         <input dojoType="dijit.form.CurrencyTextBox" name="amount" currency='USD'> </input>
78                     </td>
79                 </tr>
80                 <tr>
81                     <td><label for="amount">Percent: </label></td>
82                     <td>
83                         <input 
84                             dojoType="dijit.form.NumberTextBox" 
85                             constraints="{min:0,max:100}" 
86                             promptMessage="Please enter an amount between 0 and 100"
87                             name="percent"> 
88                         </input>
89                     </td>
90                 </tr>
91                 <tr>
92                     <td><label for="note">Note: </label></td>
93                     <td>
94                         <input dojoType="dijit.form.TextBox" name="note"> </input>
95                     </td>
96                 </tr>
97                 <tr>
98                     <td colspan='2' align='center'>
99                         <button dojoType=dijit.form.Button type="submit">Apply</button>
100                     </td>
101                 </tr>
102             </table>
103         </div>
104     </div> 
105 </div>
106
107 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
108     <div dojoType="dijit.layout.TabContainer">
109         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Summary" selected='true'>
110             <script type='dojo/connect' event='onShow'>loadFSGrid();</script>
111
112             <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
113                 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
114                     <table jsId="fundingSourceGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
115                         <thead> 
116                             <tr> 
117                                 <th field="id">ID</th> 
118                                 <th field="name" width='auto'>Name</th> 
119                                 <th field="code">Code</th> 
120                                 <th field="balance" get='getSummaryInfo'>Balance</th>
121                                 <th field="credit_total" get='getSummaryInfo'>Total Credits</th>
122                                 <th field="allocation_total" get='getSummaryInfo'>Total Debits</th>
123                                 <th field="currency_type">Currency Type</th> 
124                                 <th field="owner" width='auto' get='getOrgInfo'>Owner</th>
125                             </tr> 
126                         </thead> 
127                     </table>     
128                 </div> 
129             </div>               
130  
131         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Credits">
132             <script type='dojo/connect' event='onShow'>loadCreditGrid();
133             </script> 
134             <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
135                 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
136                     <table jsId="fsCreditGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
137                         <thead> 
138                             <tr> 
139                                 <th field="id">ID</th> 
140                                 <th field="amount">Amount</th> 
141                                 <th field="note" width='auto'>Note</th> 
142                             </tr> 
143                         </thead> 
144                     </table>     
145                 </div> 
146             </div> 
147             
148         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations">
149             <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script> 
150             <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
151                 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
152                     <table jsId="fsAllocationGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
153                         <thead> 
154                             <tr> 
155                                 <th field="id">ID</th> 
156                                 <th field="fund" get='getFund'>Fund</th> 
157                                 <th field="amount">Amount</th> 
158                                 <th field="percent">Percent</th> 
159                                 <th field="allocator">Allocated By</th> 
160                                 <th field="note" width='auto'>Note</th> 
161                             </tr> 
162                         </thead> 
163                     </table>     
164                 </div> 
165             </div> 
166         </div>
167     </div>
168 </div>
169
170 [% END %]
171