Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / acqui-home.tt
1 [% USE Asset %]
2 [% USE Price %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/datatables.css") %]
9 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") %]
10 </head>
11
12 <body id="acq_acqui-home" class="acq">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'acquisitions-search.inc' %]
15
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Acquisitions</div>
17
18 <div id="doc3" class="yui-t2">
19
20 <div id="bd">
21     <div id="yui-main">
22     <div class="yui-b">
23
24 [% INCLUDE 'acquisitions-toolbar.inc' %]
25
26 <h1>Acquisitions</h1>
27     [% INCLUDE 'budgets-active-currency.inc' hide = 'yes' %]
28     [% UNLESS ( loop_budget ) %]
29         [% IF ( CAN_user_acquisition_period_manage ) %]
30         <div class="dialog alert"><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">You must define a budget in Administration</a></div>
31         [% ELSE %]
32         <div class="dialog alert">Your administrator must define a budget in Administration</div>
33         [% END %]
34     [% END %]
35 <div class="yui-g">
36 <div class="yui-u first">
37 <div id="acqui_acqui_home_order">
38     <fieldset>
39         <legend>Manage orders</legend>
40         <form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
41             <p><label for="supplierpage">Vendor: </label><input type="text" size="25" name="supplier" id="supplierpage" class="focus" />
42             <input type="submit" value="Search" />
43             </p>
44         </form>
45     </fieldset>
46 </div>
47 </div>
48
49 [% IF ( suggestion && suggestions_count ) %]
50 <div class="yui-u">
51     <div id="acqui_acqui_home_suggestions">
52         <fieldset>
53         <legend>Pending suggestions</legend>
54             <p>[% suggestions_count %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Manage suggestions</a>.</p>
55         </fieldset>
56     </div>
57 </div>
58 [% END %]
59
60 </div>
61
62 [% IF ( loop_budget ) %]
63
64             <h3>All available funds[% IF LoginBranchname %] for [% LoginBranchname %][% END %]</h3>
65
66     <div id="BudgetsAndFunds">
67     <table id="accounts">
68         <caption>
69           <span class="actions"><a href="#" id="expand_all">Expand all</a>
70           | <a href="#" id="collapse_all">Collapse all</a>
71           | <a href="#" id="hide_inactive">Hide inactive budgets</a>
72           | <a href="#" id="show_inactive">Show inactive budgets</a></span>
73         </caption>
74
75         <thead>
76         <tr>
77             <th>Active</th>
78             <th>Budget period description</th>
79             <th>Fund code</th>
80             <th>Fund name</th>
81             <th>Owner</th>
82             <th>Library</th>
83             <th>Amount</th>
84             <th>Ordered</th>
85             <th>Spent</th>
86             <th>Total available</th>
87         </tr>
88         </thead>
89         <tfoot id="funds_total">
90         <tr>
91             <th></th>
92             <th></th>
93             <th colspan="4">Total</th>
94             <th class="data"></th>
95             <th class="data"></th>
96             <th class="data"></th>
97             <th class="data"></th>
98         </tr>
99         </tfoot>
100         <tbody>
101         [% FOREACH loop_budge IN loop_budget %]
102             [% IF loop_budge.budget_parent_id %]
103                 <tr data-tt-id="[% loop_budge.budget_id %]" data-tt-parent-id="[% loop_budge.budget_parent_id %]">
104             [% ELSE %]
105                 <tr data-tt-id="[% loop_budge.budget_id %]">
106             [% END %]
107
108                 <td>[% loop_budge.budget_period_active %]</td>
109                 <td>Budget [% loop_budge.budget_period_description %] [id=[% loop_budge.budget_period_id %]][% UNLESS loop_budge.budget_period_active %] (inactive)[% END %]</td>
110                 <td>
111                     [% IF ( CAN_user_acquisition_budget_manage ) %]
112                         <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% loop_budge.budget_period_id %]">[% loop_budge.budget_code %]</a>
113                     [% ELSE %]
114                         [% loop_budge.budget_code %]
115                     [% END %]
116                 </td>
117                 <td>[% loop_budge.budget_name %]</td>
118                 <td>[% IF ( loop_budge.budget_owner ) %]
119                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loop_budge.budget_owner.borrowernumber %]">[% loop_budge.budget_owner.surname %], [% loop_budge.budget_owner.firstname %]</a>
120                     [% ELSE %]
121                         &nbsp;
122                     [% END %]
123                 </td>
124                 <td>[% Branches.GetName( loop_budge.budget_branchcode ) %]</td>
125                 <td class="data">
126                     [% IF loop_budge.budget_parent_id %]
127                         [% loop_budge.budget_amount | $Price %]
128                     [% ELSE %]
129                         <span class="total_amount">[% loop_budge.budget_amount | $Price %]</span>
130                     [% END %]
131                 </td>
132                 <td class="data">
133                     <a href="ordered.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">
134                     [% IF loop_budge.budget_parent_id %]
135                         [% loop_budge.budget_ordered | $Price %]
136                     [% ELSE %]
137                         <span class="total_amount">[% loop_budge.budget_ordered | $Price %]</span>
138                     [% END %]
139                     </a>
140                 </td>
141                 <td class="data">
142                     <a href="spent.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">
143                     [% IF loop_budge.budget_parent_id %]
144                         [% loop_budge.budget_spent | $Price %]
145                     [% ELSE %]
146                         <span class="total_amount">[% loop_budge.budget_spent | $Price %]</span>
147                     [% END %]
148                     </a>
149                 </td>
150                 <td class="data">
151                     [% IF loop_budge.budget_parent_id %]
152                         [% loop_budge.budget_avail | $Price %]
153                     [% ELSE %]
154                         <span class="total_amount">[% loop_budge.budget_avail | $Price %]</span>
155                     [% END %]
156                 </td>
157             </tr>
158         [% END %]
159         </tbody>
160     </table>
161     </div>
162     [% END %]
163
164 </div>
165 </div>
166 <div class="yui-b">
167 [% INCLUDE 'acquisitions-menu.inc' %]
168 </div>
169 </div>
170
171 [% MACRO jsinclude BLOCK %]
172     [% INCLUDE 'datatables.inc' %]
173     [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") %]
174     [% Asset.js("js/acquisitions-menu.js") %]
175     <script type="text/javascript">
176         dt_overwrite_html_sorting_localeCompare();
177
178         $(document).ready(function() {
179
180             var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
181                 "fnDrawCallback": function ( oSettings ) {
182                     if ( oSettings.aiDisplay.length == 0 )
183                     {
184                         return;
185                     }
186
187                     var nTrs = $('#accounts tbody tr');
188                     var iColspan = nTrs[0].getElementsByTagName('td').length;
189                     var sLastGroup = "";
190                     for ( var i=0 ; i<nTrs.length ; i++ )
191                     {
192                         var iDisplayIndex = oSettings._iDisplayStart + i;
193                         var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
194                         if ( sGroup != sLastGroup )
195                         {
196                             var nGroup = document.createElement( 'tr' );
197                             var nCell = document.createElement( 'td' );
198                             nCell.colSpan = iColspan;
199                             nCell.className = "group";
200                             nCell.innerHTML = sGroup;
201                             nGroup.appendChild( nCell );
202                             nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
203                             sLastGroup = sGroup;
204                         }
205                     }
206                 },
207                 "footerCallback": function ( row, data, start, end, display ) {
208                     var api = this.api(), data;
209                     footer_column_sum( api, [ 6, 7, 8, 9 ] );
210                 },
211                 "aoColumnDefs": [
212                     { "bVisible": false, "aTargets": [ 0, 1 ] },
213                     { "bSortable": false, "aTargets": ["_all"] }
214                 ],
215                 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
216                 'bSort': true,
217                 'aaSortingFixed': [[ 1, 'asc' ]],
218                 'bPaginate': false,
219                 "bAutoWidth": false
220             }));
221
222             $(oTable).treetable({
223                 expandable: true
224             });
225             $(oTable).treetable('expandAll');
226             $("#expand_all").click(function(e){
227                 e.preventDefault();
228                 $(oTable).treetable('expandAll');
229             });
230             $("#collapse_all").click(function(e){
231                 e.preventDefault();
232                 $(oTable).treetable('collapseAll');
233             });
234
235             $("#hide_inactive").click(function(e){
236                 e.preventDefault();
237                 oTable.fnFilter( 1, 0 ); // Show only active=1
238             });
239             $("#show_inactive").click(function(e){
240                 e.preventDefault();
241                 oTable.fnFilter( '', 0 );
242             });
243             $("#hide_inactive").click();
244
245         });
246     </script>
247 [% END %]
248
249 [% INCLUDE 'intranet-bottom.inc' %]