Bug 7308: (follow-up) change color style for fund child
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tt
index af0f086..1a88548 100644 (file)
@@ -1,6 +1,14 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Administration &rsaquo; Funds[% IF ( add_form ) %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript">
+//<![CDATA[
+var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
+var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
+var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
+//]]>
+</script>
+
 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
 
 [% IF ( add_form ) %]
 //]]>
 </script>
 [% ELSE %]
-<link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
+    [% IF ( notree ) %]
+        <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+        [% INCLUDE 'datatables.inc' %]
+    [% ELSE %]
+        <link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
+        <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
+    [% END %]
 
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.qtip.js"></script>
 
 <script type="text/javascript">
             }
         });
         [% IF ( notree ) %]
-        $("#budgeth").tablesorter({
-            widgets : ['zebra'],
-            sortList: [[0,0]],
-            headers: { 7: { sorter: false }}
-        });
+            $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                ],
+                "sPaginationType": "four_button"
+            }));
         [% ELSE %]
         $("#budgeth").treeTable();
         [% END %]
 
 [% IF (error_not_authorised_to_modify) %]
     <div class="error">
-        <p>You are not authorised to modify this fund</p>
+        <p>You are not authorized to modify this fund</p>
     </div>
 [% END %]
 
 
 [% INCLUDE 'budgets-active-currency.inc' %]
 
+[% IF ( budget ) %]
+
 <table id="budgeth">
     <thead>
         <tr>
             <th>Fund code</th>
             <th>Fund name</th>
-            <th>Total<br />allocated</th>
-            <th>Base-level<br />allocated</th>
-            <th>Base-level<br />spent</th>
-            <th>Total sublevels<br />spent</th>
-            <th>Base-level<br />remaining</th>
+            <th>Base-level allocated</th>
+            <th>Base-level ordered</th>
+            <th>Total ordered</th>
+            <th>Base-level spent</th>
+            <th>Total spent</th>
+            <th>Base-level available</th>
+            <th>Total available</th>
             <th class="tooltipcontent">&nbsp;</th>
             <th>Actions</th>
         </tr>
     <tr>
     <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
     <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
-    <th nowrap="nowrap"  class="data"> [% base_alloc_total %]</th>
-    <th class="data">[% base_spent_total %]</th>
-    <th class="data">[% base_spent_total %]</th>
-    <th class="data">[% base_remaining_total %]</th>
+    <th></th>
+    <th class="data">[% ordered_total %]</th>
+    <th></th>
+    <th class="data">[% spent_total %]</th>
+    <th></th>
     <th class="tooltipcontent"></th>
+    <th class="data">[% available_total %]</th>
     <th></th>
     </tr>
     </tfoot>
     <tbody>
-    [% IF ( budget ) %]
         [% FOREACH budge IN budget %]
     [% IF ( budge.toggle ) %]
     <tr id="node-[% budge.budget_id %]" class="highlight[% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %] tooltiped">
 
     <td>[% budge.budget_code_indent %]</td>
     <td>[% budge.budget_name %]</td>
-    <td class="data">[% budge.budget_amount_total %]</td>
-    <td class="data">[% budge.budget_amount %] </td>
-    <td class="data">[% budge.budget_spent %] </td>
-    <td class="data">[% budge.total_levels_spent %]</td>
-    [% IF ( budge.remaining_pos ) %]
-        <td class="data" style="color: green;">
-    [% ELSIF ( budge.remaining_neg ) %] 
-        <td class="data" style="color: red;">
-    [% ELSE %]
-        <td class="data">
+    <td class="data">
+      [% IF budge.budget_parent_id %]
+        <span style="color:grey">[% budge.budget_amount %]</span>
+      [% ELSE %]
+        [% budge.budget_amount %]
+      [% END %]
+    </td>
+    <td class="data">
+      [% IF budge.budget_parent_id %]
+        <span style="color:grey">[% budge.budget_ordered %]</span>
+      [% ELSE %]
+        [% budge.budget_ordered %]
+      [% END %]
+    </td>
+    <td class="data">
+      [% IF budge.budget_parent_id %]
+        <span style="color:grey">[% budge.total_ordered %]</span>
+      [% ELSE %]
+        [% budge.total_ordered %]
+      [% END %]
+    </td>
+    <td class="data">
+      [% IF budge.budget_parent_id %]
+        <span style="color:grey">[% budge.budget_spent %]</span>
+      [% ELSE %]
+        [% budge.budget_spent %]
+      [% END %]
+    </td>
+    <td class="data">
+      [% IF budge.budget_parent_id %]
+        <span style="color:grey">[% budge.total_spent %]</span>
+      [% ELSE %]
+        [% budge.total_spent %]
+      [% END %]
+    </td>
+
+
+    [% BLOCK colorcellvalue %]
+        [% IF (value > 0) %]
+            <span style="color: green;">
+        [% ELSIF (value < 0) %]
+            <span style="color: red;">
+        [% ELSE %]
+            <span>
+        [% END %]
+            [% text %]
+        </span>
     [% END %]
-            [% budge.budget_remaining %] </td>
+    <td class="data">
+        [% INCLUDE colorcellvalue value=budge.budget_remaining text=budge.budget_remaining_display %]
+    </td>
+    <td class="data">
+        [% INCLUDE colorcellvalue value=budge.total_remaining text=budge.total_remaining_display %]
+    </td>
 
     <td class="tooltipcontent">[% IF ( budge.budget_owner_id ) %]<strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budge.budget_owner_id %]">[% budge.budget_owner_name %]</a>[% END %]
         [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %]
         </td>
     [% END %]
     </tr>
-        [% END %]
-    [% ELSE %]
-        <tr><td colspan="12">No fund found</td></tr>
     [% END %]
     </tbody>
 </table>
 
+[% ELSE %]
+    No fund found
+[% END %]
+
 [% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
 [% END %] <!-- else -->
 
     <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount %]" size="8" />
     </li>
 
-    <li style="display:none;">
-    <label for="budget_encumb">Encumbrance: </label>
-    <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="8" />
+    <li>
+      <label for="budget_encumb">Warning at (%): </label>
+      <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
+      <span style="color:grey">0 to disable</span>
     </li>
 
-    <li style="display:none;">
-    <label for="budget_expend">Expenditure: </label>
-    <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend %]" size="8" />
+    <li>
+      <label for="budget_expend">Warning at (amount): </label>
+      <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend %]" size="10" /><input type="hidden" name="budget_owner_id" id="budget_owner_id" value="[% budget_owner_id %]" />
+      <span style="color:grey">0 to disable</span>
     </li>
 
     <li>