Bug 20667: Update two-column templates with Bootstrap grid: Acquisitions part 1
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / acqui-home.tt
index ab06267..d7ef803 100644 (file)
@@ -1,99 +1,24 @@
+[% USE Asset %]
 [% USE Price %]
+[% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/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[
-
-dt_overwrite_html_sorting_localeCompare();
-
-$(document).ready(function() {
-
-    var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "fnDrawCallback": function ( oSettings ) {
-            if ( oSettings.aiDisplay.length == 0 )
-            {
-                return;
-            }
-
-            var nTrs = $('#accounts 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, [ 6, 7, 8, 9 ] );
-        },
-        "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');
-    $("#expand_all").click(function(e){
-        e.preventDefault();
-        $(oTable).treetable('expandAll');
-    });
-    $("#collapse_all").click(function(e){
-        e.preventDefault();
-        $(oTable).treetable('collapseAll');
-    });
-
-    $("#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();
-
-});
-//]]>
-</script>
-
+[% Asset.css("css/datatables.css") %]
+[% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") %]
 </head>
+
 <body id="acq_acqui-home" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; </div>
-
-<div id="doc3" class="yui-t2">
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Acquisitions</div>
 
-<div id="bd">
-    <div id="yui-main">
-    <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
 [% INCLUDE 'acquisitions-toolbar.inc' %]
 
@@ -101,13 +26,17 @@ $(document).ready(function() {
     [% INCLUDE 'budgets-active-currency.inc' hide = 'yes' %]
     [% UNLESS ( loop_budget ) %]
         [% IF ( CAN_user_acquisition_period_manage ) %]
-        <div class="dialog alert">You must <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget</a> in Administration</div>
+        <div class="dialog alert"><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">You must define a budget in Administration</a></div>
         [% ELSE %]
         <div class="dialog alert">Your administrator must define a budget in Administration</div>
         [% END %]
     [% END %]
-<div class="yui-g">
-<div class="yui-u first">
+<div class="row">
+    [% IF ( suggestion && suggestions_count ) %]
+        <div class="col-sm-6">
+    [% ELSE %]
+        <div class="col-sm-12">
+    [% END %]
 <div id="acqui_acqui_home_order">
     <fieldset>
         <legend>Manage orders</legend>
@@ -121,7 +50,7 @@ $(document).ready(function() {
 </div>
 
 [% IF ( suggestion && suggestions_count ) %]
-<div class="yui-u">
+<div class="col-sm-6">
     <div id="acqui_acqui_home_suggestions">
         <fieldset>
         <legend>Pending suggestions</legend>
@@ -135,7 +64,7 @@ $(document).ready(function() {
 
 [% IF ( loop_budget ) %]
 
-            <h3>All available funds[% IF ( branchname ) %] for [% branchname %][% END %]</h3>
+            <h3>All available funds[% IF LoginBranchname %] for [% LoginBranchname %][% END %]</h3>
 
     <div id="BudgetsAndFunds">
     <table id="accounts">
@@ -189,13 +118,13 @@ $(document).ready(function() {
                     [% END %]
                 </td>
                 <td>[% loop_budge.budget_name %]</td>
-                <td>[% IF ( loop_budge.budget_owner_borrowernumber ) %]
-                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loop_budge.budget_owner_borrowernumber %]">[% loop_budge.budget_owner_surname %], [% loop_budge.budget_owner_firstname %]</a>
+                <td>[% IF ( loop_budge.budget_owner ) %]
+                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loop_budge.budget_owner.borrowernumber %]">[% loop_budge.budget_owner.surname %], [% loop_budge.budget_owner.firstname %]</a>
                     [% ELSE %]
                         &nbsp;
                     [% END %]
                 </td>
-                <td>[% loop_budge.budget_branchname %]</td>
+                <td>[% Branches.GetName( loop_budge.budget_branchcode ) %]</td>
                 <td class="data">
                     [% IF loop_budge.budget_parent_id %]
                         [% loop_budge.budget_amount | $Price %]
@@ -235,10 +164,92 @@ $(document).ready(function() {
     </div>
     [% END %]
 
+</main>
+</div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+<div class="col-sm-2 col-sm-pull-10">
+    <aside>
+        [% INCLUDE 'acquisitions-menu.inc' %]
+    </aside>
 </div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'acquisitions-menu.inc' %]
-</div>
-</div>
+</div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") %]
+    [% Asset.js("js/acquisitions-menu.js") %]
+    <script>
+        dt_overwrite_html_sorting_localeCompare();
+
+        $(document).ready(function() {
+
+            var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "fnDrawCallback": function ( oSettings ) {
+                    if ( oSettings.aiDisplay.length == 0 )
+                    {
+                        return;
+                    }
+
+                    var nTrs = $('#accounts 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, [ 6, 7, 8, 9 ] );
+                },
+                "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();
+                $(oTable).treetable('expandAll');
+            });
+            $("#collapse_all").click(function(e){
+                e.preventDefault();
+                $(oTable).treetable('collapseAll');
+            });
+
+            $("#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();
+
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]