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