From 8f7d47df09d82be89150069d819516ccabfad9b5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 24 Sep 2014 17:23:42 +0200 Subject: [PATCH 14/15] 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 --- .../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 d5ca87f..f73ff27 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 %] -- 1.7.10.4