From 2523ea32e8bbc1a89dd2f2c7e5f15d1e78741ab4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 24 Sep 2014 17:23:42 +0200 Subject: [PATCH] Bug 12989: Update table footer with the visible rows - acqui-home Note that bug 12984 changes the view of this table. On the acqui-home page, the total was not updated. With this patch, the footer (totals) will be updated on filtering rows. Test plan: 1/ Go on the acqui home page. 2/ Verify the totals are correct. 3/ Filter the table using the filter input and verify the totals are updated with the rows shown. 4/ Hide/Show inactive budgets and verify the totals are still corrects. --- .../prog/en/modules/acqui/acqui-home.tt | 53 ++++++++++++++++------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt index 6c3b3eb..08b6f89 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -13,11 +13,6 @@ dt_overwrite_html_sorting_localeCompare(); $(document).ready(function() { - var inactive = $(".b_inactive,.bu_active"); - var active = $(".bu_inactive"); - inactive.hide(); - active.show(); - var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, { "fnDrawCallback": function ( oSettings ) { if ( oSettings.aiDisplay.length == 0 ) @@ -45,6 +40,10 @@ $(document).ready(function() { } } }, + "footerCallback": function ( row, data, start, end, display ) { + var api = this.api(), data; + footer_column_sum( api, [ 6, 7, 8, 9 ] ); + }, "aoColumnDefs": [ { "bVisible": false, "aTargets": [ 0, 1 ] }, { "bSortable": false, "aTargets": ["_all"] } @@ -168,10 +167,10 @@ $(document).ready(function() { Total - [% total %][% total_active %] - [% totordered %][% totordered_active %] - [% totspent %][% totspent_active %] - [% totavail %][% totavail_active %] + + + + @@ -199,10 +198,38 @@ $(document).ready(function() { [% END %] [% loop_budge.budget_branchname %] - [% loop_budge.formatted_budget_amount %] - [% loop_budge.formatted_budget_ordered %] - [% loop_budge.formatted_budget_spent %] - [% loop_budge.formatted_budget_avail %] + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.formatted_budget_amount %] + [% ELSE %] + [% loop_budge.formatted_budget_amount %] + [% END %] + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.formatted_budget_ordered %] + [% ELSE %] + [% loop_budge.formatted_budget_ordered %] + [% END %] + + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.formatted_budget_spent %] + [% ELSE %] + [% loop_budge.formatted_budget_spent %] + [% END %] + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.formatted_budget_avail %] + [% ELSE %] + [% loop_budge.formatted_budget_avail %] + [% END %] + [% END %] -- 2.1.0