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