Bug 31986: Add page-section to various administration pages
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tt
index a7a5369..195c2a6 100644 (file)
@@ -5,36 +5,89 @@
 [% USE Price %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name | html %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
-[% Asset.css("css/datatables.css") | $raw %]
+
+<title>[% IF op == 'add_form' %][% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name | html %]'[% END %][% ELSE %]Add fund[% END %] &rsaquo;[% END %] Funds &rsaquo; Administration &rsaquo; Koha</title>
 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 
 <body id="admin_aqbudgets" class="admin">
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'budgets-admin-search.inc' %]
+[% WRAPPER 'header.inc' %]
+    [% INCLUDE 'budgets-admin-search.inc' %]
+[% END %]
+
+[% WRAPPER 'sub-header.inc' %]
+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
+    <ol>
+    <li>
+        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
+    </li>
+    <li>
+        <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
+    </li>
+    <li>
+        <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
+    </li>
+
+    [% IF op == 'list' %]
+        [% IF budget_period_id %]
+            <li>
+                <a href="#" aria-current="page">
+                    Funds for '[% budget_period_description | html %]'
+                </a>
+            </li>
+        [% ELSE %]
+            <li>
+                <a href="#" aria-current="page">
+                    All funds
+                </a>
+            </li>
+        [% END %]
+    [% END %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
-    <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; [% IF op == 'list' %][% IF budget_period_id %]Funds for '[% budget_period_description | html %]'[% ELSE %]All funds[% END %][% END %]
     [% IF op == 'add_form' %]
-      <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name | html %]'[% END %][% ELSE %]Add fund[% END %]
+        <li>
+            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">Funds</a>
+        </li>
+        [% IF ( budget_id ) %]
+            <li>
+                <a href="#" aria-current="page">
+                Modify fund
+                    [% IF ( budget_name ) %] '[% budget_name | html %]'[% END %]
+                </a>
+            </li>
+        [% ELSE %]
+            <li>
+                <a href="#" aria-current="page">
+                    Add fund
+                </a>
+            </li>
+        [% END %]
     [% END %]
+
     [% IF op == 'delete_confirm' %]
-      <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?
+        <li>
+            <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a>
+        </li>
+        <li>
+            <a href="#" aria-current="page">
+                Delete fund?
+            </a>
+        </li>
     [% END %]
-</div>
-
-<div id="doc3" class="yui-t2">
-<div id="bd">
-<div id="yui-main">
-<div class="yui-b" id="content">
+    </ol>
+</nav>
+[% END %]
 
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
 [% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
 
 [% IF (error_not_authorised_to_modify) %]
-    <div class="error">
+    <div class="dialog alert">
         <p>You are not authorized to modify this fund</p>
     </div>
 [% END %]
 
 [% IF budgets %]
 
-<table id="budgeth" class="group">
     [% UNLESS budget_period_id %]
-      <caption>
-        <span class="actions"><a href="#" id="expand_all">Expand all</a>
-        | <a href="#" id="collapse_all">Collapse all</a>
-        | <a href="#" id="hide_inactive">Hide inactive budgets</a>
-        | <a href="#" id="show_inactive">Show inactive budgets</a></span>
-      </caption>
+        <div class="toolbar btn-toolbar">
+            <span class="actions">
+                <a href="#" id="expand_all">Expand all</a> |
+                <a href="#" id="collapse_all">Collapse all</a> |
+                <a href="#" id="hide_inactive">Hide inactive budgets</a> |
+                <a href="#" id="show_inactive">Show inactive budgets</a>
+            </span>
+        </div>
     [% END %]
+<div class="page-section">
+<table id="budgeth" class="group">
     <thead>
         <tr>
             <th>Active</th>
             <th>Total spent</th>
             <th>Base-level available</th>
             <th>Total available</th>
-            <th>Actions</th>
+            <th class="noExport">Actions</th>
         </tr>
     </thead>
     <tfoot>
     <tr>
     <th></th>
     <th></th>
-    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price | html %][% END %]  </th>
-    <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price | html %]</th>
+    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price %][% END %]  </th>
+    <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price %]</th>
     <th></th>
-    <th class="data">[% ordered_total | $Price | html %]</th>
+    <th class="data">[% ordered_total | $Price %]</th>
     <th></th>
-    <th class="data">[% spent_total | $Price | html %]</th>
+    <th class="data">[% spent_total | $Price %]</th>
     <th></th>
-    <th class="data">[% available_total | $Price | html %]</th>
+    <th class="data">[% available_total | $Price %]</th>
     <th></th>
     </tr>
     </tfoot>
     <td>[% budget.budget_code | html %]</td>
     <td>[% budget.budget_name | html %]</td>
     <td class="data">
-      [% IF budget.budget_parent_id %]
-        <span class="child_fund_amount">[% budget.budget_amount | $Price | html %]</span>
-      [% ELSE %]
-        <span class="total_amount">[% budget.budget_amount | $Price | html %]</span>
-      [% END %]
+        <span class="total_amount" data-parent_id="[% budget.budget_parent_id | html %]" data-self_id="[% budget.budget_id | html %]">[% budget.budget_amount | $Price %]</span>
     </td>
     <td class="data">
       [% IF budget.budget_parent_id %]
-        <span class="child_fund_amount">[% budget.budget_ordered | $Price | html %]</span>
+        <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
       [% ELSE %]
-        <span class="total_amount">[% budget.budget_ordered | $Price | html %]</span>
+        <span class="total_amount">[% budget.budget_ordered | $Price %]</span>
       [% END %]
     </td>
     <td class="data">
       [% IF budget.budget_parent_id %]
-        <span class="child_fund_amount">[% budget.total_ordered | $Price | html %]</span>
+        <span class="child_fund_amount">[% budget.total_ordered | $Price %]</span>
       [% ELSE %]
-        <span class="total_amount">[% budget.total_ordered | $Price | html %]</span>
+        <span class="total_amount">[% budget.total_ordered | $Price %]</span>
       [% END %]
     </td>
     <td class="data">
       [% IF budget.budget_parent_id %]
-        <span class="child_fund_amount">[% budget.budget_spent | $Price | html %]</span>
+        <span class="child_fund_amount">[% budget.budget_spent | $Price %]</span>
       [% ELSE %]
-        <span class="total_amount">[% budget.budget_spent | $Price | html %]</span>
+        <span class="total_amount">[% budget.budget_spent | $Price %]</span>
       [% END %]
     </td>
     <td class="data">
       [% IF budget.budget_parent_id %]
-        <span class="child_fund_amount">[% budget.total_spent | $Price | html %]</span>
+        <span class="child_fund_amount">[% budget.total_spent | $Price %]</span>
       [% ELSE %]
-        <span class="total_amount">[% budget.total_spent | $Price | html %]</span>
+        <span class="total_amount">[% budget.total_spent | $Price %]</span>
       [% END %]
     </td>
 
 
     [% BLOCK colorcellvalue %]
-        [% IF parent %]
-            [% IF (value > 0) %]
-                <span class="child_fund_amount" style="color: green;">
-            [% ELSIF (value < 0) %]
-                <span class="child_fund_amount" style="color: red;">
-            [% ELSE %]
-                <span class="child_fund_amount">
-            [% END %]
-         [% ELSE %]
-            [% IF (value > 0) %]
-                <span class="total_amount" style="color: green;">
-            [% ELSIF (value < 0) %]
-                <span class="total_amount" style="color: red;">
-            [% ELSE %]
-                <span class="totalamount">
-            [% END %]
+        [% IF (value > 0) %]
+            <span class="total_amount" data-parent_id="[% budget.budget_parent_id | html %]" data-self_id="[% budget.budget_id | html %]" style="color: green;">
+        [% ELSIF (value < 0) %]
+            <span class="total_amount" data-parent_id="[% budget.budget_parent_id | html %]" data-self_id="[% budget.budget_id | html %]" style="color: red;">
+        [% ELSE %]
+            <span class="totalamount">
         [% END %]
-            [% value | $Price | html %]
+        [% value | $Price %]
         </span>
     [% END %]
     <td class="data">
         <td> <span></span> </td>
     [% ELSE %]
         <td>
-            <div class="dropdown dropup">
+            <div class="btn-group dropup">
                 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetactions[% budget.budget_id | html %]_[% budget.budget_period_id | html %]" role="button" data-toggle="dropdown" href="#">
                    Actions <b class="caret"></b>
                 </a>
                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id | html %]_[% budget.budget_period_id | html %]">
-                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id | html %]&amp;budget_period_id=[% budget.budget_period_id | html %]"><i class="fa fa-pencil"></i> Edit</a></li>
+                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id | uri %]&amp;budget_period_id=[% budget.budget_period_id | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
                     [% IF budget.budget_has_children %]
-                        <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children"><i class="fa fa-trash"></i> Delete</a></li>
+                        <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has sub funds."><i class="fa fa-trash"></i> Delete</a></li>
                     [% ELSE %]
-                        <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id | html %]&amp;budget_period_id=[% budget.budget_period_id | html %]"><i class="fa fa-trash"></i> Delete</a></li>
+                        <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id | uri %]&amp;budget_period_id=[% budget.budget_period_id | uri %]"><i class="fa fa-trash"></i> Delete</a></li>
                     [% END %]
-                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id | html %]&amp;budget_period_id=[% budget.budget_period_id | html %]"><i class="fa fa-plus"></i> Add child fund</a></li>
+                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id | uri %]&amp;budget_period_id=[% budget.budget_period_id | uri %]"><i class="fa fa-plus"></i> Add sub fund</a></li>
                 </ul>
             </div>
         </td>
     [% END %]
     </tbody>
 </table>
+</div> <!-- /.page-section -->
 
 [% ELSE %]
     <p>No fund found</p>
 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
 <form action="/cgi-bin/koha/admin/aqbudgets.pl" id="edit_fund" name="Aform" method="post">
     <fieldset class="rows">
-    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
+        <legend><h1>[% IF ( budget_id ) %]<span>Modify fund</span>[% ELSE %]<span>Add fund</span>[% END %]
     [% IF ( budget_period_description ) %]
-        [% budget_name | html %] for Budget '[% budget_period_description | html %]'
+        [% budget_name | html %] <span>for budget</span> '[% budget_period_description | html %]'
     [% END %]
+            </h1>
     </legend>
 
     <input type="hidden" name="op" value="add_validate" />
     </li>
 
     <li>
-    <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
-    <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 | html %]" size="8" />
+    <label for="budget_amount" class="required">Amount: </label>
+    <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
     </li>
 
     <li>
 
     <li>
       <label for="budget_expend">Warning at (amount): </label>
-      <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 | html %]" size="10" />
+      <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
       <span class="hint">0 to disable</span>
     </li>
 
         <span class="label">Owner: </span>
         [% IF  budget_owner %]
             <span  id="budget_owner_name">
-                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner.borrowernumber | html %]">
+                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner.borrowernumber | uri %]">
                     [% budget_owner.firstname | html %] [% budget_owner.surname | html %]
                 </a> |
             </span>
         <li class="radio">
             <label>
                 <input type="checkbox" id="set_owner_to_children" name="set_owner_to_children" value="1" />
-                Update all child funds with this owner
+                Update all sub funds with this owner
             </label>
             <span class="hint">Selecting this option will overwrite existing fund owners, if any</span>
         </li>
         <ul style="float:left;" id="budget_users">
             [% FOREACH user IN budget_users %]
                 <li id="user_[% user.borrowernumber | html %]">
-                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber | html %]">
+                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber | uri %]">
                         [% user.firstname | html %] [% user.surname | html %]
                     </a>
                     &bull; <a href="#" class="del_user" data-borrowernumber="[% user.borrowernumber | html %]"><i class="fa fa-trash"></i> Remove</a>
     </li>
 
     <li>
-    <label  style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
+    <label  for="authorised_value_category1">Statistic 1 done on: </label>
         <select name="sort1_authcat" id="authorised_value_category1">
             <option value=""></option>
             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort1_authcat ) %]
         </select>
     </li>
     <li>
-    <label  style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
+    <label  for="authorised_value_category2">Statistic 2 done on: </label>
         <select name="sort2_authcat" id="authorised_value_category2">
             <option value=""></option>
             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort2_authcat ) %]
 
 [% IF op == 'delete_confirm' %]
     <div class="dialog alert">
-        <h3>Delete fund [% budget_name | html %]?</h3>
+        <h1>Delete fund [% budget_name | html %]?</h1>
         If you delete this fund, all orders linked to this fund will be deleted!
         <table>
             <tr>
             <th scope="row">Fund amount:</th>
-            <td>[% budget_amount | $Price | html %]</td>
+            <td>[% budget_amount | $Price %]</td>
             </tr>
         </table>
 
     </div>
 [% END %]
 
-</div>
-</div>
-<div class="yui-b">
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+
 [% IF op == 'list' %]
   <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
     <a href="#" id="filterbutton">Filters</a>
             <label for="filter_budgetbranch2">Library: </label>
             <select name="filter_budgetbranch" id="filter_budgetbranch2">
                 <option value=""></option>
-                [% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
+                [% PROCESS options_for_libraries libraries => Branches.all( selected => selected_branchcode, unfiltered => 1 ) %]
             </select>
         </li>
         <li class="radio">
         <input type="submit" class="submit" name="filter" value="Go" />
     </fieldset>
 </form>[% END %]
-[% INCLUDE 'acquisitions-menu.inc' %]
-</div>
-</div>
-[% MACRO jsinclude BLOCK %]
-    [% Asset.js("js/acq.js") | $raw %]
-    <script type="text/javascript">
-        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>
 
+                [% INCLUDE 'acquisitions-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
     [% Asset.js("js/acq.js") | $raw %]
     [% IF op == 'add_form' %]
-        <script type="text/javascript">
+        <script>
         //<![CDATA[
 
             function userPopup() {
-                window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
+                window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add&filter=funds_users",
                     'PatronPopup',
-                    'width=740,height=450,location=yes,toolbar=no,'
+                    'width=1024,height=768,location=yes,toolbar=no,'
                     + 'scrollbars=yes,resize=yes'
                 );
             }
 
             function ownerPopup() {
-                window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
+                window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=select&filter=funds_owners",
                     'PatronPopup',
-                    'width=740,height=450,location=yes,toolbar=no,'
+                    'width=1024,height=768,location=yes,toolbar=no,'
                     + 'scrollbars=yes,resize=yes'
                 );
             }
         </script>
     [% ELSIF op == 'list' %]
         [% INCLUDE 'datatables.inc' %]
+        [% INCLUDE 'columns_settings.inc' %]
         [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
 
-        <script type="text/javascript">
+        <script>
         //<![CDATA[
             //
             $(document).ready(function() {
-                var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
-                    "fnDrawCallback": function ( oSettings ) {
-                        if ( oSettings.aiDisplay.length == 0 )
-                        {
-                            return;
-                        }
+                [% IF budgets %]
+                    var oTable = KohaTable("budgeth", {
+                        "fnDrawCallback": function ( oSettings ) {
+                            if ( oSettings.aiDisplay.length == 0 )
+                            {
+                                return;
+                            }
 
-                        var nTrs = $('#budgeth tbody tr');
-                        var iColspan = nTrs[0].getElementsByTagName('td').length;
-                        var sLastGroup = "";
-                        for ( var i=0 ; i<nTrs.length ; i++ )
-                        {
-                            var iDisplayIndex = oSettings._iDisplayStart + i;
-                            var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
-                            if ( sGroup != sLastGroup )
+                            var nTrs = $('#budgeth tbody tr');
+                            var iColspan = nTrs[0].getElementsByTagName('td').length;
+                            var sLastGroup = "";
+                            for ( var i=0 ; i<nTrs.length ; i++ )
                             {
-                                var nGroup = document.createElement( 'tr' );
-                                var nCell = document.createElement( 'td' );
-                                nCell.colSpan = iColspan;
-                                nCell.className = "group";
-                                nCell.innerHTML = sGroup;
-                                nGroup.appendChild( nCell );
-                                nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
-                                sLastGroup = sGroup;
+                                var iDisplayIndex = oSettings._iDisplayStart + i;
+                                var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
+                                if ( sGroup != sLastGroup )
+                                {
+                                    var nGroup = document.createElement( 'tr' );
+                                    var nCell = document.createElement( 'td' );
+                                    nCell.colSpan = iColspan;
+                                    nCell.className = "group";
+                                    nCell.innerHTML = sGroup;
+                                    nGroup.appendChild( nCell );
+                                    nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
+                                    sLastGroup = sGroup;
+                                }
                             }
-                        }
-                    },
-                    "footerCallback": function ( row, data, start, end, display ) {
-                        var api = this.api(), data;
-                        footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
-                    },
-                    "aoColumnDefs": [
-                        { "bVisible": false, "aTargets": [ 0, 1 ] },
-                        { "bSortable": false, "aTargets": ["_all"] }
-                    ],
-                    'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
-                    'bSort': true,
-                    'aaSortingFixed': [[ 1, 'asc' ]],
-                    'bPaginate': false,
-                    "bAutoWidth": false
-                }));
-
-                $(oTable).treetable({
-                    expandable: true
-                });
-                $(oTable).treetable('expandAll');
-                $("#expand_all").click(function(e){
-                    e.preventDefault();
+                        },
+                        "footerCallback": function ( row, data, start, end, display ) {
+                            var api = this.api(), data;
+                            footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
+                        },
+                        "aoColumnDefs": [
+                            { "bVisible": false, "aTargets": [ 0, 1 ] },
+                            { "bSortable": false, "aTargets": ["_all"] }
+                        ],
+                        'bSort': true,
+                        'aaSortingFixed': [[ 1, 'asc' ]],
+                        'bPaginate': false,
+                        "bAutoWidth": false
+                    });
+
+                    $(oTable).treetable({
+                        expandable: true
+                    });
                     $(oTable).treetable('expandAll');
-                });
-                $("#collapse_all").click(function(e){
-                    e.preventDefault();
-                    $(oTable).treetable('collapseAll');
-                });
-
-                [% UNLESS budget_period_id %]
-                  $("#hide_inactive").click(function(e){
-                    e.preventDefault();
-                    oTable.fnFilter( 1, 0 ); // Show only active=1
-                  });
-                  $("#show_inactive").click(function(e){
-                    e.preventDefault();
-                    oTable.fnFilter( '', 0 );
-                  });
-                  $("#hide_inactive").click();
+                    $("#expand_all").click(function(e){
+                        e.preventDefault();
+                        $(oTable).treetable('expandAll');
+                    });
+                    $("#collapse_all").click(function(e){
+                        e.preventDefault();
+                        $(oTable).treetable('collapseAll');
+                    });
+
+                    [% UNLESS budget_period_id %]
+                      $("#hide_inactive").click(function(e){
+                        e.preventDefault();
+                        oTable.fnFilter( 1, 0 ); // Show only active=1
+                      });
+                      $("#show_inactive").click(function(e){
+                        e.preventDefault();
+                        oTable.fnFilter( '', 0 );
+                      });
+                      $("#hide_inactive").click();
+                    [% END %]
+                    oTable.fnAddFilters("filter", 750);
                 [% END %]
-                oTable.fnAddFilters("filter", 750);
 
                 $("#filterbutton").click(function() {
                     $("#fundfilters").slideToggle(0);
 
                 $(".deletefund-disabled").tooltip().on("click", function(e){
                     e.preventDefault();
-                    alert(_("This fund has children. It cannot be deleted."));
+                    alert(_("This fund has sub funds. It cannot be deleted."));
                 });
             });
         //]]>