6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Administration › OPAC problem reports</title>
8 [% INCLUDE 'doc-head-close.inc' %]
11 <body id="tools_problem-reports" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'prefs-admin-search.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25 <a href="#" aria-current="page">
32 <div class="main container-fluid">
34 <div class="col-sm-10 col-sm-push-2">
37 <h1>OPAC problem reports</h1>
39 <div class="dialog alert" id="error" style="display:none;"></div>
41 [% IF ( selected_count ) %]
42 <div class="dialog message">
43 [% IF ( action == 'viewed' ) %]
44 <span>[% selected_count | html %] problem report(s) marked as viewed.</span>
45 [% ELSIF ( action == 'closed' ) %]
46 <span>[% selected_count | html %] problem report(s) marked as closed.</span>
47 [% ELSIF ( action == 'new' ) %]
48 <span>[% selected_count | html %] problem report(s) marked as new.</span>
50 <span>Failed to change the status of [% selected_count | html %] problem report(s).</span>
55 [% IF ( problem_reports.count ) %]
56 <form id="mark_selected" method="post" action="/cgi-bin/koha/tools/problem-reports.pl">
57 <div id="toolbar" class="btn-toolbar">
58 <button type="submit" class="btn btn-default markviewed" name="mark_selected-viewed" value="viewed" disabled="disabled"><i class="fa fa-eye"></i> Mark viewed</button>
59 <button type="submit" class="btn btn-default markclosed" name="mark_selected-closed" value="closed" disabled="disabled"><i class="fa fa-times-circle"></i> Mark closed</button>
60 <button type="submit" class="btn btn-default marknew" name="mark_selected-new" value="new" disabled="disabled"><i class="fa fa-star"></i> Mark new</button>
63 <fieldset class="action" style="cursor:pointer;">
64 <a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
65 | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
66 | <a class="HideViewed"><i class="fa fa-minus-square"></i> Hide viewed</a>
67 | <a class="HideClosed"><i class="fa fa-minus-square"></i> Hide closed</a>
68 | <a class="HideNew"><i class="fa fa-minus-square"></i> Hide new</a>
69 | <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
72 <table id="problemreportstable">
75 <th class="NoSort"> </th>
76 <th class="anti-the">Message</th>
79 <th class="title-string">Created on</th>
82 <th class="NoSort noExport">Actions</th>
86 [% FOREACH report IN problem_reports %]
88 <td><input type="checkbox" name="report_ids" value="[% report.reportid | html %]"></td>
90 <strong>[% report.title | html %]</strong><br>
91 [% report.content | html %]
93 <td><a href="[% OPACBaseURL | url %][% report.problempage | url %]">[% OPACBaseURL | url %][% report.problempage | html %]</a></td>
95 [% SWITCH report.recipient %]
96 [% CASE 'admin' %]Koha administrator
97 [% CASE 'library' %]A librarian
100 <td><span title="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</span></td>
101 <td>[% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %]</td>
102 <td class="status[% report.status | html %]" name="status">
103 <span id="status_[% report.reportid | html %]">
104 [% SWITCH report.status %]
106 [% CASE 'Closed' %]Closed
107 [% CASE 'Viewed' %]Viewed
108 [% CASE %]Unknown status ([% report.status | html %])
113 [% IF ( report.status == 'New' ) %]
114 <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" disabled="disabled" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button>
115 [% ELSIF ( report.status == 'Viewed' ) %]
116 <button name="viewed" disabled="disabled" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button>
118 <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" disabled="disabled" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button>
129 <div class="dialog message">There are currently no problem reports.</div>
130 [% END %] <!-- problem reports -->
133 </div> <!-- /.col-sm-10.col-sm-push-2 -->
135 <div class="col-sm-2 col-sm-pull-10">
137 [% INCLUDE 'tools-menu.inc' %]
139 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
141 </div> <!-- /.row -->
143 [% MACRO jsinclude BLOCK %]
144 [% INCLUDE 'calendar.inc' %]
145 [% INCLUDE 'datatables.inc' %]
147 $(document).ready(function(){
148 $("#problemreportstable").dataTable($.extend(true, {}, dataTablesDefaults, {
149 "order": [[ 1, "asc" ]],
151 { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
152 { "type": "title-string", "targets" : [ "title-string" ] },
153 { "type": "anti-the", "targets": [ "anti-the" ] }
158 $(".SelectAll").on("click", function(){
159 $("input[name='report_ids'][type='checkbox']").prop("checked", true);
160 $(".markviewed").prop("disabled", false);
161 $(".markclosed").prop("disabled", false);
162 $(".marknew").prop("disabled", false);
165 $(".ClearAll").on("click", function(){
166 $("input[name='report_ids'][type='checkbox']").prop("checked", false);
167 $(".markviewed").prop("disabled", true);
168 $(".markclosed").prop("disabled", true);
169 $(".marknew").prop("disabled", true);
174 $(".HideViewed").on("click", function(){
175 $(".statusViewed").parent().hide();
178 $(".HideClosed").on("click", function(){
179 $(".statusClosed").parent().hide();
182 $(".HideNew").on("click", function(){
183 $(".statusNew").parent().hide();
186 $(".ShowAll").on("click", function(){
192 $("#problemreportstable").on("change", "input[type='checkbox']", function(){
193 if ( $("input[type='checkbox']").is(":checked") ) {
194 $(".markviewed").prop("disabled", false);
195 $(".markclosed").prop("disabled", false);
196 $(".marknew").prop("disabled", false);
198 $(".markviewed").prop("disabled", true);
199 $(".markclosed").prop("disabled", true);
200 $(".marknew").prop("disabled", true);
204 $("#problemreportstable").on("click", "button.viewed, button.closed, button.new", function(event){
205 event.preventDefault(); // prevent form submission
206 var $action = $(this).attr("name");
207 var $report_id = $(this).data('report_id');
210 'report_id': $report_id,
214 url: '/cgi-bin/koha/svc/problem_reports/',
220 .done(function(data){
221 if (data.status == 'success'){
222 if ( $action == 'viewed' ){
223 $("#status_" + $report_id).text(_("Viewed"));
224 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusViewed");
225 $(event.target).siblings(".closed").prop("disabled", false);
226 $(event.target).siblings(".new").prop("disabled", false);
227 $(event.target).prop("disabled", true);
228 } else if ( $action == 'new' ){
229 $("#status_" + $report_id).text(_("New"));
230 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusNew");
231 $(event.target).siblings(".closed").prop("disabled", false);
232 $(event.target).siblings(".viewed").prop("disabled", false);
233 $(event.target).prop("disabled", true);
235 $("#status_" + $report_id).text(_("Closed"));
236 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusClosed");
237 $(event.target).siblings(".viewed").prop("disabled", false);
238 $(event.target).siblings(".new").prop("disabled", false);
239 $(event.target).prop("disabled", true);
242 $("#error").text(_("Unable to change status of problem report."));
246 .error(function(data){
247 $("#error").text(_("Unable to change status of problem report."));
255 [% INCLUDE 'intranet-bottom.inc' %]