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