5 [% PROCESS 'i18n.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9 [% t("OPAC problem reports") | html %] ›
10 [% t("Tools") | html %] ›
11 [% t("Koha") | html %]
13 [% INCLUDE 'doc-head-close.inc' %]
16 <body id="tools_problem-reports" class="tools">
18 [% WRAPPER 'header.inc' %]
19 [% INCLUDE 'prefs-admin-search.inc' %]
22 [% WRAPPER 'sub-header.inc' %]
23 [% WRAPPER breadcrumbs %]
24 [% WRAPPER breadcrumb_item %]
25 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
27 [% WRAPPER breadcrumb_item bc_active= 1 %]
28 <span>OPAC problem reports</span>
30 [% END #/ WRAPPER breadcrumbs %]
31 [% END #/ WRAPPER sub-header.inc %]
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
38 <h1>OPAC problem reports</h1>
40 <div class="dialog alert" id="error" style="display:none;"></div>
42 [% IF ( selected_count ) %]
43 <div class="dialog message">
44 [% IF ( action == 'viewed' ) %]
45 <span>[% selected_count | html %] problem report(s) marked as viewed.</span>
46 [% ELSIF ( action == 'closed' ) %]
47 <span>[% selected_count | html %] problem report(s) marked as closed.</span>
48 [% ELSIF ( action == 'new' ) %]
49 <span>[% selected_count | html %] problem report(s) marked as new.</span>
51 <span>Failed to change the status of [% selected_count | html %] problem report(s).</span>
56 [% IF ( problem_reports.count ) %]
57 <form id="mark_selected" method="post" action="/cgi-bin/koha/tools/problem-reports.pl">
58 <div id="toolbar" class="btn-toolbar">
59 <button type="submit" class="btn btn-default markviewed" name="mark_selected-viewed" value="viewed" disabled="disabled"><i class="fa-solid fa-eye"></i> Mark viewed</button>
60 <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>
61 <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>
64 <div class="btn-toolbar selections-toolbar">
65 <a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
66 | <a class="ClearAll"><i class="fa fa-times"></i> Clear all</a>
67 | <a class="HideViewed"><i class="fa fa-minus-square"></i> Hide viewed</a>
68 | <a class="HideClosed"><i class="fa fa-minus-square"></i> Hide closed</a>
69 | <a class="HideNew"><i class="fa fa-minus-square"></i> Hide new</a>
70 | <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
73 <table id="problemreportstable">
76 <th class="NoSort"> </th>
77 <th class="anti-the">Message</th>
83 <th class="NoSort noExport">Actions</th>
87 [% FOREACH report IN problem_reports %]
89 <td><input type="checkbox" name="report_ids" value="[% report.reportid | html %]"></td>
91 <strong>[% report.title | html %]</strong><br>
92 [% report.content | html %]
94 <td><a href="[% OPACBaseURL | url %][% report.problempage | url %]">[% OPACBaseURL | url %][% report.problempage | html %]</a></td>
96 [% SWITCH report.recipient %]
97 [% CASE 'admin' %]<span>Koha administrator</span>
98 [% CASE 'library' %]<span>A librarian</span>
101 <td data-order="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</td>
102 <td>[% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %]</td>
103 <td class="status[% report.status | html %]" name="status">
104 <span id="status_[% report.reportid | html %]">
105 [% SWITCH report.status %]
106 [% CASE 'New' %]<span>New</span>
107 [% CASE 'Closed' %]<span>Closed</span>
108 [% CASE 'Viewed' %]<span>Viewed</span>
109 [% CASE %]<span>Unknown status ([% report.status | html %])</span>
114 [% IF ( report.status == 'New' ) %]
115 <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa-solid 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>
116 [% ELSIF ( report.status == 'Viewed' ) %]
117 <button name="viewed" disabled="disabled" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa-solid 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>
119 <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa-solid 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>
130 <div class="dialog message">There are currently no problem reports.</div>
131 [% END %] <!-- problem reports -->
134 </div> <!-- /.col-sm-10.col-sm-push-2 -->
136 <div class="col-sm-2 col-sm-pull-10">
138 [% INCLUDE 'tools-menu.inc' %]
140 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
142 </div> <!-- /.row -->
144 [% MACRO jsinclude BLOCK %]
145 [% INCLUDE 'calendar.inc' %]
146 [% INCLUDE 'datatables.inc' %]
148 $(document).ready(function(){
149 $("#problemreportstable").dataTable($.extend(true, {}, dataTablesDefaults, {
150 "order": [[ 1, "asc" ]],
152 { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
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' %]