1 [% INCLUDE 'blocking_errors.inc' %]
2 <div id="toolbar" class="btn-toolbar">
3 [% IF ( CAN_user_reports_create_reports ) %]
4 <div class="btn-group">
5 <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New report <span class="caret"></span></button>
6 <ul class="dropdown-menu">
7 <li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>
8 <li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
9 [% IF Koha.Preference('Mana')==1 %]
10 <li id="newsql"><a href="" data-toggle="modal" data-target="#mana_search_result">New SQL from Mana</a> </li>
16 [% IF ( showsql || execute || editsql || save_successful ) %]
17 [% IF ( CAN_user_reports_create_reports ) %]
18 [% UNLESS ( editsql ) # Do not show edit button on edit page %]
19 <div class="btn-group">
20 <a id="editreport" class="btn btn-default btn-sm" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&phase=Edit%20SQL">
21 <i class="fa fa-pencil"></i> Edit
25 <div class="btn-group">
26 <a class="btn btn-default btn-sm" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% original_sql || sql |uri %]&reportname=[% reportname |uri %]&notes=[% notes |uri %]">
27 <i class="fa fa-copy"></i> Duplicate
32 [% IF ( CAN_user_reports_delete_reports ) %]
33 <div class="btn-group">
34 <a class="delete btn btn-default btn-sm" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&phase=Delete%20Saved">
35 <i class="fa fa-trash"></i> Delete
40 [% UNLESS ( errors ) # Unless there are errors saving a report %]
41 <div class="btn-group">
42 <a id="runreport" class="btn btn-default btn-sm" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&phase=Run%20this%20report">
43 <i class="fa fa-play"></i> Run report
46 <div class="btn-group">
47 <a class="btn btn-default btn-sm" href="/cgi-bin/koha/tools/scheduler.pl?id=[% id | html %]">
48 <i class="fa fa-clock-o"></i> Schedule
53 [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
54 <div class="btn-group">
55 <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
56 <ul class="dropdown-menu">
57 [% FOREACH c IN mana_comments %]
58 <li class="mana-comment" data-id="[% c.id | $raw %]">
59 <a href="#">[% c.message | html %] ([% c.nb | html %])</a>
62 <li role="separator" class="divider"></li>
63 <li class="mana-other-comment"><a href="#">Other</a> </li>
67 <div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
68 <div class="modal-dialog modal-lg" style="width: 30%">
69 <div class="modal-content" style="">
70 <div class="modal-header">
71 <button type="button" id="mana-comment-close" class="closebtn" aria-hidden="true">×</button>
72 <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
74 <div class="modal-body">
75 <input hidden id="mana-resource" value="report">
76 <input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
78 <input type="text" maxlength="35" size="35" id="mana-comment">
80 <button id="mana-send-comment"> Comment </button>
89 [%- FOREACH param IN sql_params %]&sql_params=[% param | uri %][% END %]
90 [%- FOREACH param_name IN param_names %]&param_name=[% param_name | uri %][% END %]
94 <div class="btn-group">
95 <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" id="format"><i class="fa fa-upload"></i> Download <span class="caret"></span></button>
96 <ul class="dropdown-menu">
97 <li><a id="csv" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=csv&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">[% PROCESS 'delimiter_text.inc' %]</a></li>
98 <li><a id="tab" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=tab&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">Tab separated text</a></li>
99 <li><a id="ods" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=ods&report_id=[% id | html %]&reportname=[% name |uri %][% PROCESS params %]">Open Document Spreadsheet</a></li>
100 [% IF (results.json) %]
101 <li><a id="download-chart" href="#">Chart (.svg)</a></li>
105 <div class="btn-group">
106 <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_hid" href="#"><i class="fa fa-eye"></i> Show SQL code</a>
107 <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide SQL code</a>
109 <div class="btn-group">
110 <a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#chartModal"><i class="fa fa-bar-chart"></i> Create chart</a>
117 [% IF Koha.Preference('Mana')==1 %]
118 <div id="mana_search_result" class="modal fade container-fluid" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;">
119 <div class="modal-dialog modal-lg">
120 <div class="modal-content">
121 <div class="modal-header">
122 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
123 <h3 id="mana_search_result_label"> Mana Search</h3>
126 <div class="modal-body">
128 <form id="mana_search_form" style="margin-left: 5%">
129 Please enter a few key words:
130 <input type="text" id="mana_search_field">
131 <input type="submit" class="mana_search_button" value="Search">
134 <div class="mana_result_content">
144 function mana_use( mana_id ){
147 url: "/cgi-bin/koha/svc/mana/use",
148 data: {id:mana_id, resource: 'report', saveinbase: 1},
151 .done( function (result){
152 if ( result.errmsg ){
153 alert( result.errmsg );
156 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1&phase=Edit%20SQL");
159 .fail( function ( foo, msg, longmsg, bla ){
163 function mana_search( textquery ){
164 $(document.body).css({'cursor' : 'wait'});
167 url: "/cgi-bin/koha/svc/mana/search",
168 data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1},
171 .done( function( result ) {
172 $(document.body).css({'cursor' : 'default'});
173 $("#mana_search_result .modal-body .mana_result_content").html(result);
174 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
175 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
176 "sPaginationType":"four_button",
179 { "width": "35%", "targets": 1 }
182 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
183 { "sType": "title-string", "aTargets" : [ "title-string" ] },
184 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
187 if($("td.dataTables_empty").length == 0){
188 $("#mana_search").show();
191 $( "select[class='actionreport1']" ).show();
192 $( "button[class='actionreport2']" ).hide();
194 $(".showbutton").on("click", function(){
195 $(this).parent().hide();
196 $(this).parent().next().show();
199 $("a[class='hidebutton']").on("click", function(){
200 $(this).parent().hide();
201 $(this).parent().prev().show();
204 $("#commentCloseButton").on("click", function(){
205 $("#comment_box").modal("hide");
208 $(".actionreport1").on("click", function(){
209 $("#selectedcomment").val($(this).val());
210 $(this).parent("select").hide();
211 $(this).parent("select").next().show();
214 $(".actionreport2").on("click", function(){
216 $(this).prev().show();
217 mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1);
219 }).fail( function( result ){