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>
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 data-order="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</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": "anti-the", "targets": [ "anti-the" ] }
157 $(".SelectAll").on("click", function(){
158 $("input[name='report_ids'][type='checkbox']").prop("checked", true);
159 $(".markviewed").prop("disabled", false);
160 $(".markclosed").prop("disabled", false);
161 $(".marknew").prop("disabled", false);
164 $(".ClearAll").on("click", function(){
165 $("input[name='report_ids'][type='checkbox']").prop("checked", false);
166 $(".markviewed").prop("disabled", true);
167 $(".markclosed").prop("disabled", true);
168 $(".marknew").prop("disabled", true);
173 $(".HideViewed").on("click", function(){
174 $(".statusViewed").parent().hide();
177 $(".HideClosed").on("click", function(){
178 $(".statusClosed").parent().hide();
181 $(".HideNew").on("click", function(){
182 $(".statusNew").parent().hide();
185 $(".ShowAll").on("click", function(){
191 $("#problemreportstable").on("change", "input[type='checkbox']", function(){
192 if ( $("input[type='checkbox']").is(":checked") ) {
193 $(".markviewed").prop("disabled", false);
194 $(".markclosed").prop("disabled", false);
195 $(".marknew").prop("disabled", false);
197 $(".markviewed").prop("disabled", true);
198 $(".markclosed").prop("disabled", true);
199 $(".marknew").prop("disabled", true);
203 $("#problemreportstable").on("click", "button.viewed, button.closed, button.new", function(event){
204 event.preventDefault(); // prevent form submission
205 var $action = $(this).attr("name");
206 var $report_id = $(this).data('report_id');
209 'report_id': $report_id,
213 url: '/cgi-bin/koha/svc/problem_reports/',
219 .done(function(data){
220 if (data.status == 'success'){
221 if ( $action == 'viewed' ){
222 $("#status_" + $report_id).text(_("Viewed"));
223 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusViewed");
224 $(event.target).siblings(".closed").prop("disabled", false);
225 $(event.target).siblings(".new").prop("disabled", false);
226 $(event.target).prop("disabled", true);
227 } else if ( $action == 'new' ){
228 $("#status_" + $report_id).text(_("New"));
229 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusNew");
230 $(event.target).siblings(".closed").prop("disabled", false);
231 $(event.target).siblings(".viewed").prop("disabled", false);
232 $(event.target).prop("disabled", true);
234 $("#status_" + $report_id).text(_("Closed"));
235 $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusClosed");
236 $(event.target).siblings(".viewed").prop("disabled", false);
237 $(event.target).siblings(".new").prop("disabled", false);
238 $(event.target).prop("disabled", true);
241 $("#error").text(_("Unable to change status of problem report."));
245 .error(function(data){
246 $("#error").text(_("Unable to change status of problem report."));
254 [% INCLUDE 'intranet-bottom.inc' %]