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