Bug 21467: Add treetable to subscription detail to group orders by parent ordernumber
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 1 Oct 2018 23:44:29 +0000 (20:44 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 13 Nov 2018 19:31:10 +0000 (19:31 +0000)
Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt

index 1c15bd3..2c68488 100644 (file)
@@ -11,6 +11,7 @@
 <title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid | html %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% Asset.css("css/datatables.css") | $raw %]
+[% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
 </head>
 
 <body id="ser_subscription-detail" class="ser">
 
                 <thead>
                     <tr>
+                        <th class="NoVisible">Timestamp</th>
                         <th>Invoice</th>
                         <th>Basket</th>
                         <th>Order number</th>
                 </thead>
                 <tbody>
                 [% FOR order IN orders %]
-                    <tr>
+                    [% IF order.parent_ordernumber != order.ordernumber %]
+                        <tr data-tt-id="[% order.ordernumber | html %]" data-tt-parent-id="[% order.parent_ordernumber | html %]">
+                    [% ELSE %]
+                        <tr data-tt-id="[% order.parent_ordernumber | html %]">
+                    [% END %]
+                        <td>[% order.timestamp | html %]</td>
                         <td>
                         [% IF order.invoice %]
                             [% IF CAN_user_acquisition %]
     </script>
     [% Asset.js("js/serials-toolbar.js") | $raw %]
     [% INCLUDE 'datatables.inc' %]
+    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
     [% INCLUDE 'columns_settings.inc' %]
     <script>
         // the english words used in display purposes
 
             var columns_settings = [% ColumnsSettings.GetColumns( 'serials', 'subscription-detail', 'orders', 'json' ) | $raw %];
             var table = KohaTable("orders", {
-                'bPaginate': false,
-                'bAutoWidth': false,
-                "aaSorting": [[ 5, "asc" ], [ 2, "desc" ]], // Order by status then ordernumber
                 "aoColumnDefs": [
+                    { "bVisible": false, "aTargets": [ 'NoVisible' ] },
+                    { "bSortable": false, "aTargets": ["_all"] },
                     { "aTargets": "title-string", "sType": "title-string" }
-                ]
+                ],
+
+                'bPaginate': false,
+                'bAutoWidth': false,
+                'bSort': true,
+                'aaSortingFixed': [[ 0, 'desc' ]],
+                "bSortCellsTop": true
             }, columns_settings);
 
+            $(table).treetable({
+                expandable: true
+            });
+            $(table).treetable('expandAll');
+
             $("#hide_received_orders").click(function(e){
                 e.preventDefault();
                 table.fnFilter( '^$', 4, true ); // Not empty "Receive date" columns