Bug 20350: Add column configuration to table of saved reports
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tt
index b9daca6..7f5d368 100644 (file)
@@ -1,5 +1,6 @@
 [% USE KohaDates %]
 [% USE Koha %]
+[% USE ColumnsSettings %]
 [% SET footerjs = 1 %]
 [%- BLOCK area_name -%]
     [%- SWITCH area -%]
     #col1, #col2 { width:45%; float:left; }
     #col1 ins, #col2 del { display: none; }
     .show_sql { font-family: monospace; }
+    .send_to_item_mod {
+        background-color: #EBF3FF;
+        border: 1px solid #88b0e8;
+        border-radius: 5px;
+        display: inline-block;
+        font-size: 75%;
+        margin: 3px 5px;
+        padding: 3px 5px;
+        white-space: nowrap;
+    }
 </style>
 [% IF ( saved1 ) %]
-    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% END %]
 </head>
 
@@ -168,7 +179,7 @@ canned reports and writing custom SQL reports.</p>
                     [% IF (usecache) %] <th>Cache expiry (seconds)</th> [% END %]
                     <th>Saved results</th>
                     [% IF has_obsolete_reports %]<th>Update</th>[% END %]
-                    <th>&nbsp;</th>
+                    <th>Actions</th>
                 </tr>
             </thead>
             <tbody>
@@ -204,9 +215,9 @@ canned reports and writing custom SQL reports.</p>
                         </td>
                         <td class="report_json_url">
                         [% IF (savedreport.public) %]
-                            <a href="[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]">[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
+                            <a href="[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
                         [% ELSE %]
-                            <a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]">[% Koha.Preference('staffClientBaseURL') %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
+                            <a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% Koha.Preference('staffClientBaseURL') %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
                         [% END %]
                         </td>
                         [% IF (usecache) %] <td>[% savedreport.cache_expiry %]</td> [% END %]
@@ -705,14 +716,33 @@ canned reports and writing custom SQL reports.</p>
 
 <div class="pages">[% pagination_bar %]</div>
 [% UNLESS ( errors ) %]
-<table>
-<tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
-[% FOREACH result IN results %]
-<tr>
-    [% FOREACH cell IN result.cells %]<td>[% cell.cell %]</td>[% END %]
-</tr>
-[% END %]
-</table>
+    <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
+        <input type="hidden" name="op" value="show" />
+        <table>
+            <tr>
+                [% FOREACH header_ro IN header_row %]
+                    [% IF header_ro.cell == 'itemnumber' %]
+                        <th>
+                            [% header_ro.cell %] <button type="submit" data-toggle="tooltip" title="Send visible items to batch modification" class="btn btn-xs btn-default send_to_item_mod"><i class="fa fa-pencil"></i> Batch modify</button>
+                        </th>
+                    [% ELSE %]
+                        <th>[% header_ro.cell %]</th>
+                    [% END %]
+                [% END %]
+            </tr>
+            [% FOREACH result IN results %]
+                <tr>
+                    [% FOREACH cells IN result.cells %]
+                        [% place = loop.index %]
+                        [% IF header_row.$place.cell == 'itemnumber' %]
+                            <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
+                        [% END %]
+                        <td>[% cells.cell %]</td>
+                    [% END %]
+                </tr>
+            [% END %]
+        </table>
+    </form>
 [% END %]
 [% END %]
 
@@ -812,6 +842,17 @@ Sub report:<select name="subreport">
 </fieldset>
 [% END %]
 
+[% IF ( save_successful ) %]
+[% UNLESS ( errors ) %]
+</br>
+<div id="report_updated">
+    <div class="dialog message">
+        <p>Your report "[% reportname %]" has been saved</p>
+    </div>
+</div>
+[% END %]
+[% END %]
+
 [% IF ( editsql ) %]
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
 <input type="hidden" name="phase" value="Update SQL" />
@@ -854,21 +895,6 @@ Sub report:<select name="subreport">
 
 [% END %]
 
-[% IF ( save_successful ) %]
-[% UNLESS ( errors ) %]
-<h2>Your report has been saved</h2>
-<h4>[% reportname %]</h4>
-<ul>
-    [% IF ( id ) %]
-    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report">Run this report</a></li>
-    [% END %]
-    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports page</a></li>
-    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler tool</a></li>
-    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided reports</a></li>
-</ul>
-[% END %]
-[% END %]
-
 [% IF ( errors ) %]
 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
 <div class="dialog alert">
@@ -928,8 +954,9 @@ Sub report:<select name="subreport">
     [% INCLUDE 'calendar.inc' %]
     [% IF ( saved1 ) %]
         [% INCLUDE 'datatables.inc' %]
+        [% INCLUDE 'columns_settings.inc' %]
     [% END %]
-    <script type="text/javascript">
+    <script>
         var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
         var group_subgroups = {};
         [% FOREACH group IN groups_with_subgroups %]
@@ -959,10 +986,18 @@ Sub report:<select name="subreport">
         }
 
         $(document).ready(function(){
+
+            $('[data-toggle="tooltip"]').tooltip();
+            var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) %];
+
             $('#limit').change(function() {
                 $('#limitselect').submit();
             });
 
+            $(document).click(function() {
+                $('#report_updated').hide();
+            });
+
             $(".goback").on("click",function(e){
                 e.preventDefault();
                 window.history.back();
@@ -977,7 +1012,7 @@ Sub report:<select name="subreport">
             });
 
             [% IF (saved1) %]
-                var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
+                var rtable = KohaTable("table_reports", {
                     'iDisplayLength': [% Koha.Preference('NumSavedReports') %],
                     'bAutoWidth': false,
                     'sPaginationType': 'four_button',
@@ -990,8 +1025,8 @@ Sub report:<select name="subreport">
                     ],
                     'oLanguage': {
                         'sZeroRecords': _("No matching reports found")
-                    }
-                }));
+                    },
+                }, columns_settings);
 
                 var rtabs = $("#tabs").tabs();
                 rtabs.on("tabsactivate", function(e, ui) {