]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2
added create functionality
[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             <script>
112                 /** Define the columns for the funding source grid ----- */
113                 var fundingSourceGridLayout = [{
114                     cells : [[
115                         {name: 'ID', field: 'id'},
116                         {name: 'Name', field: "name", width:'auto'}, 
117                         {name: 'Code', field: "code"},
118                         {name: 'Balance', get:getSummaryInfo, field:'balance'},
119                         {name: 'Total Credits', get:getSummaryInfo, field:'credit_total'},
120                         {name: 'Total Debits', get:getSummaryInfo, field:'allocation_total'},
121                         {name: 'Currency Type', field: "currency_type"},
122                         {name: 'Owner', field: "owner", width:'auto', get:getOrgInfo}, 
123                     ]]
124                 }];
125             </script>
126             <div jsId='fundingSourceGrid' dojoType="dojox.Grid" structure='fundingSourceGridLayout'> </div>
127         </div>
128         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Credits">
129             <script type='dojo/connect' event='onShow'>loadCreditGrid();</script>
130             <script>
131                 /** Define the columns for the funding source credits grid ----- */
132                 var fsCreditGridLayout = [{
133                     cells : [[
134                         {name: 'ID', field: 'id'},
135                         {name: 'Amount', field: "amount"}, 
136                         {name: 'Note', field: "note", width:'auto'}, 
137                     ]]
138                 }];
139             </script>
140             <div jsId='fsCreditGrid' dojoType="dojox.Grid" structure='fsCreditGridLayout'> </div>
141         </div>
142         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations">
143             <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script>
144             <script>
145                 /** Define the columns for the funding source allocations grid ----- */
146                 var fsAllocationGridLayout = [{
147                     cells : [[
148                         {name: 'ID', field: 'id'},
149                         {name: 'Fund', field: "fund", get:getFund}, 
150                         {name: 'Amount', field: "amount"}, 
151                         {name: 'Percent', field: "percent"}, 
152                         {name: 'Allocated By', field: "allocator"}, 
153                         {name: 'Note', field: "note", width:'auto'}, 
154                     ]]
155                 }];
156             </script>
157             <div jsId='fsAllocationGrid' dojoType="dojox.Grid" structure='fsAllocationGridLayout'> </div>
158         </div>
159     </div>
160 </div>
161 [% END %]
162