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