Bug 7298: (follow-up) various QA fixes
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / acqui-home.tt
index 86650eb..4fabffe 100644 (file)
@@ -1,29 +1,53 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions</title>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
+
+dt_overwrite_html_sorting_localeCompare();
+
 $(document).ready(function() {
+
+    var inactive = $(".b_inactive,.bu_active");
+    var active = $(".bu_inactive");
+    inactive.hide();
+    active.show();
+
     $('#showallbudgets').click(function() {
-       if ( $('#showallbudgets:checked').val() !== undefined) {
-           $('.b_inactive').show();
-           $('#b_inactive').show();
-           $('.bu_active').show();
-           $('.bu_inactive').hide();
-       }
-       else {
-           $('.b_inactive').hide();
-           $('#b_inactive').hide();
-           $('.bu_inactive').show();
-           $('.bu_active').hide();
-       }
+        if ( $('#showallbudgets:checked').val() !== undefined) {
+            inactive.show();
+            active.hide();
+        }
+        else {
+            inactive.hide();
+            active.show();
+        }
     });
+    var srlt = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumns": [
+            null,
+            null,
+            null,
+            null,
+            null,
+            { "sType": "title-numeric" },
+            { "sType": "title-numeric" },
+            { "sType": "title-numeric" },
+            { "sType": "title-numeric" }
+        ],
+        'sDom': 't',
+        'bPaginate': false,
+        'bFilter': false,
+        'bInfo': false
+    } ) );
 });
 //]]>
 </script>
 
 </head>
-<body>
+<body id="acq_acqui-home" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
@@ -38,48 +62,43 @@ $(document).ready(function() {
 [% INCLUDE 'acquisitions-toolbar.inc' %]
 
 <h1>Acquisitions</h1>
+    [% UNLESS ( loop_budget ) %]
+        [% IF ( CAN_user_acquisition_period_manage ) %]
+        <div class="dialog alert">You must <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget</a> in Administration</div>
+        [% ELSE %]
+        <div class="dialog alert">Your administrator must define a budget in Administration</div>
+        [% END %]
+    [% END %]
 <div class="yui-g">
 <div class="yui-u first">
 <div id="acqui_acqui_home_order">
     <fieldset>
         <legend>Manage orders</legend>
-    [% IF ( nobudget ) %]
-        [% IF ( CAN_user_parameters ) %]
-        <span class="problem">You must <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget</a> in Administration</span>
-        [% ELSE %]
-        <span class="problem">Your administrator must define a budget in Administration</span>
-        [% END %]
-        <form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
-            <p><label for="supplierpage">Vendor </label><input type="text" size="25" name="supplier" id="supplierpage" class="focus" />
-            <input type="submit" value="Search" />
-            </p>
-        </form>
-    [% ELSE %]
         <form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
             <p><label for="supplierpage">Vendor: </label><input type="text" size="25" name="supplier" id="supplierpage" class="focus" />
             <input type="submit" value="Search" />
             </p>
         </form>
-
-    [% END %]
     </fieldset>
 </div>
-
-[% IF ( suggestion ) %][% IF ( suggestions_count ) %]
-<div id="acqui_acqui_home_suggestions">
-    <fieldset>
-    <legend>Pending suggestions</legend>
-        <p>[% suggestions_count %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl">Manage suggestions</a>.</p>
-    </fieldset>
-</div>[% END %][% END %]
-
 </div>
 
+[% IF ( suggestion && suggestions_count ) %]
 <div class="yui-u">
+    <div id="acqui_acqui_home_suggestions">
+        <fieldset>
+        <legend>Pending suggestions</legend>
+            <p>[% suggestions_count %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl">Manage suggestions</a>.</p>
+        </fieldset>
+    </div>
+</div>
+[% END %]
+
+</div>
 
-        [% IF ( loop_budget ) %]
+[% IF ( loop_budget ) %]
 
-            <h3>All available funds[% IF ( branchname ) %] for [% branchname %] branch[% END %]</h3>
+            <h3>All available funds[% IF ( branchname ) %] for [% branchname %] library[% END %]</h3>
 
     <!-- <a href="/cgi-bin/koha/admin/aqbookfund.pl" title="[ Manage funds ]">[ Manage ]</a>
     <a href="/cgi-bin/koha/admin/budgetperiods.pl">manage budgets</a><br><br>  -->
@@ -87,12 +106,15 @@ $(document).ready(function() {
 
 
     <div id="BudgetsAndFunds">
+    <p><label for="showallbudgets">Show active and inactive:</label> <input type="checkbox" id="showallbudgets" /></p>
     <table id="accounts">
         <thead>
         <tr>
             <th>Fund</th>
+            <th>Fund name</th>
+            <th class="b_inactive">Active</th>
             <th>Owner</th>
-            <th>Branch</th>
+            <th>Library</th>
             <th>Amount</th>
             <th>Ordered</th>
             <th>Spent</th>
@@ -103,51 +125,70 @@ $(document).ready(function() {
         <tr>
             <th>Total</th>
             <th>&nbsp;</th>
+            <th class="b_inactive">&nbsp;</th>
+            <th>&nbsp;</th>
             <th>&nbsp;</th>
-            <th align="right" ><span class="bu_active" style="display : none;">[% total %]</span><span class="bu_inactive" >[% total_active %]</span></th>
-            <th align="right" ><span class="bu_active" style="display : none;">[% totordered %]</span><span class="bu_inactive" >[% totordered_active %]</span></th>
-            <th align="right" ><span class="bu_active" style="display : none;">[% totspent %]</span><span class="bu_inactive" >[% totspent_active %]</span></th>
-            <th align="right" ><span class="bu_active" style="display : none;">[% totavail %]</span><span class="bu_inactive" >[% totavail_active %]</span></th>
+            <th class="data"><span class="bu_active">[% total %]</span><span class="bu_inactive" >[% total_active %]</span></th>
+            <th class="data"><span class="bu_active">[% totordered %]</span><span class="bu_inactive" >[% totordered_active %]</span></th>
+            <th class="data"><span class="bu_active">[% totspent %]</span><span class="bu_inactive" >[% totspent_active %]</span></th>
+            <th class="data"><span class="bu_active">[% totavail %]</span><span class="bu_inactive" >[% totavail_active %]</span></th>
         </tr>
         </tfoot>
         <tbody>
         [% FOREACH loop_budge IN loop_budget %]
-           [% IF ( loop_budge.budget_period_active ) %]
-            [% IF ( loop.odd ) %]
-                <tr>
-            [% ELSE %]
-                <tr class="highlight">
-            [% END %]
-                <td align="center">[% loop_budge.budget_code %]</td>
-                <td align="center">[% loop_budge.budget_owner %]</td>
-                <td align="center">[% loop_budge.budget_branchname %]</td>
-                <td align="right" >[% loop_budge.budget_amount %]</td>
-                <td align="right" >[% loop_budge.budget_ordered %]</td>
-                <td align="right" >[% loop_budge.budget_spent %]</td>
-                <td align="right" >[% loop_budge.budget_avail %]</td>
+        [% IF ( loop_budge.budget_period_active ) %]
+            <tr>
+                <td>
+                    [% IF ( CAN_user_acquisition_budget_manage ) %]
+                        <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% loop_budge.budget_period_id %]">[% loop_budge.budget_code %]</a>
+                    [% ELSE %]
+                        [% loop_budge.budget_code %]
+                    [% END %]
+                </td>
+                <td>[% loop_budge.budget_name %]</td>
+                <td class="b_inactive">Active</td>
+                <td>[% IF ( loop_budge.budget_owner_borrowernumber ) %]
+                        <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>
+                    [% ELSE %]
+                        &nbsp;
+                    [% END %]
+                </td>
+                <td>[% loop_budge.budget_branchname %]</td>
+                <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
+                <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
+                <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
+                <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
+            </tr>
+        [% ELSE %]
+            <tr class="b_inactive">
+                <td>
+                    [% IF ( CAN_user_acquisition_budget_manage ) %]
+                        <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% loop_budge.budget_period_id %]">[% loop_budge.budget_code %]</a>
+                    [% ELSE %]
+                        [% loop_budge.budget_code %]
+                    [% END %]
+                </td>
+                <td>[% loop_budge.budget_name %]</td>
+                <td class="b_inactive">Inactive</td>
+                <td>[% IF ( loop_budge.budget_owner_borrowernumber ) %]
+                        <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>
+                    [% ELSE %]
+                        &nbsp;
+                    [% END %]
+                </td>
+                <td>[% loop_budge.budget_branchname %]</td>
+                <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
+                <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
+                <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&amp;fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
+                <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
             </tr>
-            [% ELSE %]
-            [% IF ( loop.odd ) %]
-                <tr class="b_inactive" style="display : none;">
-            [% ELSE %]
-                <tr class="highlight" id = "b_inactive" style="display : none;">
-            [% END %]
-            <td align="center" >[% loop_budge.budget_code %]</td>
-                <td align="center">[% loop_budge.budget_owner %]</td>
-                <td align="center">[% loop_budge.budget_branchname %]</td>
-                <td align="right" >[% loop_budge.budget_amount %]</td>
-                <td align="right" >[% loop_budge.budget_ordered %]</td>
-                <td align="right" >[% loop_budge.budget_spent %]</td>
-                <td align="right" >[% loop_budge.budget_avail %]</td>
-            [% END %]
+        [% END %]
         [% END %]
         </tbody>
     </table>
-    </div><span class="label">Show all :&nbsp;</span><input type="checkbox" id="showallbudgets" />
+    </div>
     [% END %]
-</div>
 
-</div>
 </div>
 </div>
 <div class="yui-b">