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