Bug 16242 - Move staff client JavaScript out of language directory
[koha_ffzg] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tt
index 95e4f8f..2719a43 100644 (file)
@@ -1,14 +1,22 @@
+[% USE Price %]
 [% 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>
+<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == '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" src="[% themelang %]/js/acq.js"></script>
+<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>
 
-[% IF ( add_form ) %]
+<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
+[% IF op == 'add_form' %]
 <script type="text/javascript">
 //<![CDATA[
 
     function userPopup() {
-        window.open("/cgi-bin/koha/admin/aqbudget_user_search.pl?type=user",
+        window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
             'PatronPopup',
             'width=740,height=450,location=yes,toolbar=no,'
             + 'scrollbars=yes,resize=yes'
     }
 
     function ownerPopup() {
-        window.open("/cgi-bin/koha/admin/aqbudget_user_search.pl?type=owner",
+        window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
             'PatronPopup',
             'width=740,height=450,location=yes,toolbar=no,'
             + 'scrollbars=yes,resize=yes'
         );
     }
 
-    function edit_owner(borrowernumber, surname, firstname) {
-        $('#budget_owner_name').empty();
-        $('#budget_owner_id').val('');
+    function select_user(borrowernumber, borrower) {
+        ownerRemove();
+        var borrowername = borrower.firstname + ' ' + borrower.surname
         if (borrowernumber) {
             var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
                 + '?borrowernumber=' + borrowernumber + '">'
-                + firstname + ' ' + surname + '</a>';
+                + borrowername + '</a>';
             $('#budget_owner_name').html(ownerlink);
             $('#budget_owner_id').val(borrowernumber);
         }
     }
 
     function ownerRemove() {
-        edit_owner(0);
+        $('#budget_owner_name').empty();
+        $('#budget_owner_id').val('');
     }
 
-    function add_user(borrowernumber, surname, firstname) {
+    function add_user(borrowernumber, borrowername) {
         var ids = $("#budget_users_id").val().split(':');
         if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
             var li = '<li id="user_' + borrowernumber + '">'
                 + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
-                + borrowernumber + '">' + firstname + ' ' + surname
+                + borrowernumber + '">' + borrowername
                 + '</a> [<a style="cursor:pointer"'
                 + 'onclick="del_user(' + borrowernumber +')">Remove</a>]</li>';
             $(li).insertBefore("li#add_user_button");
     }
 //]]>
 </script>
-[% ELSE %]
-    [% IF ( notree ) %]
-        <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-        <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-        [% INCLUDE 'datatables-strings.inc' %]
-        <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
-    [% 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.qtip.js"></script>
+[% ELSIF op == 'list' %]
+    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+    [% INCLUDE 'datatables.inc' %]
+    <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
 
 <script type="text/javascript">
 //<![CDATA[
     //
     $(document).ready(function() {
-        var tooltipcontent = $(".tooltipcontent");
-        tooltipcontent.hide();
-
-        $(".tooltiped td").each(function (){
-            contentelem = $(this).parent().children().filter(".tooltipcontent");
-            if(contentelem.html() != ""){
-            $(this).qtip({
-                content: contentelem.html(),
-                show: "mouseover",
-                hide: "mouseout",
-                style: {
-                    name: "light",
-                    tip: "bottomLeft",
-                    border: {
-                        radius: 5,
-                        color: "#356CA1"
-                    }
-                },
-                position: {
-                    corner: {
-                        target: "topRight",
-                        tooltip: "bottomRight"
+
+
+        var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "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 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
         });
-        [% IF ( notree ) %]
-            $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
-                "aoColumnDefs": [
-                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-                ],
-                "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
-                "iDisplayLength": 20,
-                "sPaginationType": "four_button"
-            }));
-        [% ELSE %]
-        $("#budgeth").treeTable();
+        $(oTable).treetable('expandAll');
+        $("#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);
 
         $("#filterbutton").click(function() {
             $("#fundfilters").slideToggle(0);
         });
+
+        $(".deletefund-disabled").tooltip().on("click", function(e){
+            e.preventDefault();
+            alert(_("This fund has children. It cannot be deleted."));
+        });
     });
 //]]>
 </script>
 [% INCLUDE 'budgets-admin-search.inc' %]
 
 <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 ( else ) %]Funds for '[% budget_period_description %]'[% END %][% IF ( add_form ) %]
-    <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %][% END %]  [% IF ( delete_confirm ) %]
-    <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?[% END %]</div>
+    <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 %]'[% ELSE %]All funds[% END %][% END %]
+    [% IF op == 'add_form' %]
+      <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %]
+    [% END %]
+    [% IF op == 'delete_confirm' %]
+      <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?
+    [% END %]
+</div>
 
 <div id="doc3" class="yui-t2">
 <div id="bd">
 <div class="yui-b" id="content">
 
 
-[% UNLESS ( delete_confirm ) %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
+[% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% 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 %]
 
-[% IF ( else ) %]
+[% IF op == 'list' %]
 
-<h1>Funds for '[% budget_period_description %]'</h1>
+<h1>
+  [% IF budget_period_id %]
+    Funds for '[% budget_period_description %]'
+  [% ELSE %]
+    All funds
+  [% END %]
+</h1>
 
 [% INCLUDE 'budgets-active-currency.inc' %]
 
-[% IF ( budget ) %]
+[% IF budgets %]
 
-<table id="budgeth">
+<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>
+    [% END %]
     <thead>
         <tr>
+            <th>Active</th>
+            <th>Budget period description</th>
             <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 class="tooltipcontent">&nbsp;</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>Actions</th>
         </tr>
     </thead>
-<tfoot>
+    <tfoot>
     <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 class="tooltipcontent"></th>
+    <th></th>
+    <th></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 %]</th>
+    <th></th>
+    <th class="data">[% spent_total | $Price %]</th>
+    <th></th>
+    <th class="data">[% available_total | $Price %]</th>
     <th></th>
     </tr>
     </tfoot>
     <tbody>
-        [% 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">
+    [% FOREACH budget IN budgets %]
+    [% IF budget.budget_parent_id %]
+      <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
     [% ELSE %]
-    <tr id="node-[% budge.budget_id %]" class="tooltiped [% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %]">
+      <tr data-tt-id="[% budget.budget_id %]">
     [% END %]
-
-    <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>[% budget.budget_period_active %]</td>
+    <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
+    <td>[% budget.budget_code %]</td>
+    <td>[% budget.budget_name %]</td>
+    <td class="data">
+      [% IF budget.budget_parent_id %]
+        <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span>
+      [% ELSE %]
+        <span class="total_amount">[% budget.budget_amount | $Price %]</span>
+      [% END %]
+    </td>
+    <td class="data">
+      [% IF budget.budget_parent_id %]
+        <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
+      [% ELSE %]
+        <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 %]</span>
+      [% ELSE %]
+        <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 %]</span>
+      [% ELSE %]
+        <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 %]</span>
+      [% ELSE %]
+        <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 %]
+        [% END %]
+            [% value | $Price %]
+        </span>
     [% END %]
-            [% budge.budget_remaining %] </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 %]
-        [% IF ( budge.budget_notes ) %]<br /><strong>Notes: </strong>[% budge.budget_notes %][% END %]
-        [% IF ( budge.budget_hierarchy ) %]
-            <ul class="budget_hierarchy">[% FOREACH budget_hierarch IN budge.budget_hierarchy %]
-                [% IF ( budget_hierarch.element_id ) %]
-                    <li><a href="?op=add_form&amp;budget_id=[% budget_hierarch.element_id %]&amp;budget_period_id=[% budget_hierarch.budget_period_id %]">[% budget_hierarch.element_name %]</a></li>
-                [% ELSE %]
-                    <li><strong>[% budget_hierarch.element_name %] : </strong></li>
-                [% END %]
-                [% END %]
-            </ul>
-        [% END %]</td>
-    [% IF ( budge.budget_lock ) %]
-        <td> <span style="color: gray;"> Edit Delete </span> </td>
+    <td class="data">
+        [% INCLUDE colorcellvalue value=budget.budget_remaining parent=budget.budget_parent_id %]
+    </td>
+    <td class="data">
+        [% INCLUDE colorcellvalue value=budget.total_remaining parent=budget.budget_parent_id %]
+    </td>
+    [% IF ( budget.budget_lock ) %]
+        <td> <span></span> </td>
     [% ELSE %]
         <td>
-            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]" >Edit</a>
-            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]">Delete</a>
-            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]">Add child fund</a>
+            <div class="dropdown dropup">
+                <a class="btn btn-mini dropdown-toggle" id="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]" 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 %]_[% budget.budget_period_id %]">
+                    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]"><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>
+                    [% ELSE %]
+                        <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]"><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 %]&amp;budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-plus"></i> Add child fund</a></li>
+                </ul>
+            </div>
         </td>
     [% END %]
     </tr>
 </table>
 
 [% ELSE %]
-    No fund found
+    <p>No fund found</p>
 [% END %]
 
-[% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
-[% END %] <!-- else -->
+[% END %] <!-- list -->
 
 <!-- ********************************************************************************************** -->
 <!-- create add/mod entry form -->
-[% IF ( add_form && !error_not_authorised_to_modify ) %]
+[% IF op == 'add_form' && !error_not_authorised_to_modify %]
 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
     <fieldset class="rows">
     <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
 
     <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 %]" size="8" />
+    <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" 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 class="hint">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 | $Price on_editing => 1 %]" size="10" />
+      <span class="hint">0 to disable</span>
     </li>
 
     <li>
         <input type="hidden" name="budget_owner_id" id="budget_owner_id"
             value="[% budget_owner_id %]" />
 
-        <!-- FIXME: hardcoded button positions :/ -->
         <input type="button" id="edit_owner" value="Edit owner"
             onclick="ownerPopup(); return false;" />
         <input type="button" id="remove_owner" value="Remove owner"
             onclick="ownerRemove(); return false;" />
     </li>
 
+    [% IF budget_has_children %]
+        <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
+            </label>
+            <span class="hint">Selecting this option will overwrite existing fund owners, if any</span>
+        </li>
+    [% END %]
+
     <li>
         <span class="label">Users:</span>
         <ul style="float:left;" id="budget_users">
 
 [% END %] <!-- add_form -->
 
-[% IF ( delete_confirm ) %]
-<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
-<table>
-    <tr>
-    <th scope="row">Fund amount:</th>
-    <td>[% budget_amount %]</td>
-    </tr>
-</table>
-
-<form action="[% action %]" method="post">
-    <input type="hidden" name="op" value="delete_confirmed" />
-    <input type="hidden" name="budget_id" value="[% budget_id %]" />
-    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
-    <input type="submit" value="Delete" class="approve" />
-</form>
-
-<form action="[% action %]" method="get">
-    <input type="submit" class="deny" value="Cancel" />
-</form>
-</div>
+[% IF op == 'delete_confirm' %]
+    <div class="dialog alert">
+        <h3>Delete fund [% budget_name %]?</h3>
+        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 %]</td>
+            </tr>
+        </table>
+
+        <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
+            <input type="hidden" name="op" value="delete_confirmed" />
+            <input type="hidden" name="budget_id" value="[% budget_id %]" />
+            <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
+            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this fund</button>
+        </form>
+        <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
+            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
+        </form>
+    </div>
 [% END %]
 
 </div>
 </div>
 <div class="yui-b">
-[% IF ( else ) %]<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
+[% IF op == 'list' %]
+  <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
     <a href="#" id="filterbutton">Filters</a>
     <fieldset class="brief" id="fundfilters">
     <h4>Fund filters</h4>
         </li>
         <li class="radio">
 
-        <label for="show_mine">Show my funds only</label>
+        <label for="show_mine">Show my funds only:</label>
             [% IF ( show_mine ) %]
                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
             [% ELSE %]
                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
         [% END %]
         </li>
+
+        [% IF periods %]
+          <li>
+            <label for="periods">Budget:</label>
+            <select id="periods" name="budget_period_id">
+              <option value="">All budgets</option>
+              [% FOR period IN periods %]
+                [% IF budget_period_id && period.budget_period_id == budget_period_id %]
+                  <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
+                [% ELSE %]
+                  <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
+                [% END %]
+              [% END %]
+            </select>
+          </li>
+        [% END %]
         </ol>
 
-        <input type="hidden" name="show" value="1" />
-        <input type="hidden"  name="budget_period_id" value="[% budget_period_id %]" />
+        <input type="hidden" name="op" value="list" />
         <input type="submit" class="submit" name="filter" value="Go" />
     </fieldset>
 </form>[% END %]