From 860ec0aec6c8031c93838bc79490eef8289e5ef6 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. Signed-off-by: Paola Rossi Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../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 d5ca87f312..f73ff27ec3 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 @@ -14,11 +14,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 ) @@ -46,6 +41,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"] } @@ -169,10 +168,10 @@ $(document).ready(function() { Total - [% total %][% total_active | $Price %] - [% totordered %][% totordered_active | $Price %] - [% totspent %][% totspent_active | $Price %] - [% totavail %][% totavail_active | $Price %] + + + + @@ -200,10 +199,38 @@ $(document).ready(function() { [% END %] [% loop_budge.budget_branchname %] - [% loop_budge.budget_amount | $Price %] - [% loop_budge.budget_ordered | $Price %] - [% loop_budge.budget_spent | $Price %] - [% loop_budge.budget_avail | $Price %] + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.budget_amount | $Price %] + [% ELSE %] + [% loop_budge.budget_amount | $Price %] + [% END %] + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.budget_ordered | $Price %] + [% ELSE %] + [% loop_budge.budget_ordered | $Price %] + [% END %] + + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.budget_spent | $Price %] + [% ELSE %] + [% loop_budge.budget_spent | $Price %] + [% END %] + + + + [% IF loop_budge.budget_parent_id %] + [% loop_budge.budget_avail | $Price %] + [% ELSE %] + [% loop_budge.budget_avail | $Price %] + [% END %] + [% END %] -- 2.39.5