Bug 25744: replace <b> with <strong> in the staff interface
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / problem-reports.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Administration &rsaquo; OPAC problem reports</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 </head>
10
11 <body id="tools_problem-reports" class="tools">
12
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'prefs-admin-search.inc' %]
15 <div id="breadcrumbs">
16     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
17     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
18     OPAC problem reports
19 </div>
20
21 <div class="main container-fluid">
22     <div class="row">
23         <div class="col-sm-10 col-sm-push-2">
24             <main>
25
26             <h1>OPAC problem reports</h1>
27
28             <div class="dialog alert" id="error" style="display:none;"></div>
29
30             [% IF ( selected_count ) %]
31                 <div class="dialog message">
32                     [% IF ( action == 'viewed' ) %]
33                         <span>[% selected_count | html %] problem report(s) marked as viewed.</span>
34                     [% ELSIF ( action == 'closed' ) %]
35                         <span>[% selected_count | html %] problem report(s) marked as closed.</span>
36                     [% ELSIF ( action == 'new' ) %]
37                         <span>[% selected_count | html %] problem report(s) marked as new.</span>
38                     [% ELSE %]
39                         <span>Failed to change the status of [% selected_count | html %] problem report(s).</span>
40                     [% END %]
41                 </div>
42             [% END %]
43
44             [% IF ( problem_reports.count ) %]
45                 <form id="mark_selected" method="post" action="/cgi-bin/koha/tools/problem-reports.pl">
46                     <div id="toolbar" class="btn-toolbar">
47                         <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>
48                         <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>
49                         <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>
50                     </div>
51
52                     <fieldset class="action" style="cursor:pointer;">
53                         <a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
54                         | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
55                         | <a class="HideViewed"><i class="fa fa-minus-square"></i> Hide viewed</a>
56                         | <a class="HideClosed"><i class="fa fa-minus-square"></i> Hide closed</a>
57                         | <a class="HideNew"><i class="fa fa-minus-square"></i> Hide new</a>
58                         | <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
59                     </fieldset>
60
61                     <table id="problemreportstable">
62                         <thead>
63                             <tr>
64                                 <th class="NoSort">&nbsp;</th>
65                                 <th class="anti-the">Message</th>
66                                 <th>Problem page</th>
67                                 <th>Sent to</th>
68                                 <th class="title-string">Created on</th>
69                                 <th>Set by</th>
70                                 <th>Status</th>
71                                 <th class="NoSort">Actions</th>
72                             </tr>
73                         </thead>
74                         <tbody>
75                             [% FOREACH report IN problem_reports %]
76                                 <tr>
77                                     <td><input type="checkbox" name="report_ids" value="[% report.reportid | html %]"></td>
78                                     <td>
79                                         <strong>[% report.title | html %]</strong><br>
80                                         [% report.content | html %]
81                                     </td>
82                                     <td><a href="[% OPACBaseURL | url %][% report.problempage | url %]">[% OPACBaseURL | url %][% report.problempage | html %]</a></td>
83                                     <td>
84                                         [% SWITCH report.recipient %]
85                                         [% CASE 'admin' %]Koha administrator
86                                         [% CASE 'library' %]A librarian
87                                         [% END %]
88                                     </td>
89                                     <td><span title="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</span></td>
90                                     <td>[% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %]</td>
91                                     <td class="status[% report.status | html %]" name="status">
92                                         <span id="status_[% report.reportid | html %]">
93                                             [% SWITCH report.status %]
94                                             [% CASE 'New' %]New
95                                             [% CASE 'Closed' %]Closed
96                                             [% CASE 'Viewed' %]Viewed
97                                             [% CASE %]Unknown status ([% report.status | html %])
98                                             [% END %]
99                                         </span>
100                                     </td>
101                                     <td class="actions">
102                                         [% IF ( report.status == 'New' ) %]
103                                             <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>
104                                         [% ELSIF ( report.status == 'Viewed' ) %]
105                                             <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>
106                                         [% ELSE %]
107                                             <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>
108                                         [% END %]
109                                     </td>
110                                 </tr>
111                             [% END %]
112                         </tbody>
113                     </table>
114
115                 </form>
116
117             [% ELSE %]
118                 <div class="dialog message">There are currently no problem reports.</div>
119             [% END %] <!-- problem reports -->
120
121             </main>
122         </div> <!-- /.col-sm-10.col-sm-push-2 -->
123
124         <div class="col-sm-2 col-sm-pull-10">
125             <aside>
126                 [% INCLUDE 'tools-menu.inc' %]
127             </aside>
128         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
129
130     </div> <!-- /.row -->
131
132 [% MACRO jsinclude BLOCK %]
133     [% INCLUDE 'calendar.inc' %]
134     [% INCLUDE 'datatables.inc' %]
135     <script>
136         $(document).ready(function(){
137             $("#problemreportstable").dataTable($.extend(true, {}, dataTablesDefaults, {
138                 "order": [[ 1, "asc" ]],
139                 "aoColumnDefs": [
140                     { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
141                     { "type": "title-string", "targets" : [ "title-string" ] },
142                     { "type": "anti-the", "targets": [ "anti-the" ] }
143                 ],
144                 "pagingType": "full"
145             }));
146
147             $(".SelectAll").on("click", function(){
148                 $("input[name='report_ids'][type='checkbox']").prop("checked", true);
149                 $(".markviewed").prop("disabled", false);
150                 $(".markclosed").prop("disabled", false);
151                 $(".marknew").prop("disabled", false);
152             });
153
154             $(".ClearAll").on("click", function(){
155                 $("input[name='report_ids'][type='checkbox']").prop("checked", false);
156                 $(".markviewed").prop("disabled", true);
157                 $(".markclosed").prop("disabled", true);
158                 $(".marknew").prop("disabled", true);
159             });
160
161
162
163             $(".HideViewed").on("click", function(){
164                 $(".statusViewed").parent().hide();
165             });
166
167             $(".HideClosed").on("click", function(){
168                 $(".statusClosed").parent().hide();
169             });
170
171             $(".HideNew").on("click", function(){
172                 $(".statusNew").parent().hide();
173             });
174
175             $(".ShowAll").on("click", function(){
176                 $("tr").show();
177             });
178
179             $("#error").hide();
180
181             $("#problemreportstable").on("change", "input[type='checkbox']", function(){
182                 if ( $("input[type='checkbox']").is(":checked") ) {
183                     $(".markviewed").prop("disabled", false);
184                     $(".markclosed").prop("disabled", false);
185                     $(".marknew").prop("disabled", false);
186                 } else {
187                     $(".markviewed").prop("disabled", true);
188                     $(".markclosed").prop("disabled", true);
189                     $(".marknew").prop("disabled", true);
190                 }
191             });
192
193             $("#problemreportstable").on("click", "button.viewed, button.closed, button.new", function(event){
194                 event.preventDefault(); // prevent form submission
195                 var $action = $(this).attr("name");
196                 var $report_id = $(this).data('report_id');
197                 var ajaxData = {
198                     'action': $action,
199                     'report_id': $report_id,
200                 };
201
202                 $.ajax({
203                     url: '/cgi-bin/koha/svc/problem_reports/',
204                     type: 'POST',
205                     dataType: 'json',
206                     data: ajaxData,
207                 })
208
209                 .done(function(data){
210                     if (data.status == 'success'){
211                         if ( $action == 'viewed' ){
212                             $("#status_" + $report_id).text(_("Viewed"));
213                             $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusViewed");
214                             $(event.target).siblings(".closed").prop("disabled", false);
215                             $(event.target).siblings(".new").prop("disabled", false);
216                             $(event.target).prop("disabled", true);
217                         } else if ( $action == 'new' ){
218                             $("#status_" + $report_id).text(_("New"));
219                             $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusNew");
220                             $(event.target).siblings(".closed").prop("disabled", false);
221                             $(event.target).siblings(".viewed").prop("disabled", false);
222                             $(event.target).prop("disabled", true);
223                         } else {
224                             $("#status_" + $report_id).text(_("Closed"));
225                             $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusClosed");
226                             $(event.target).siblings(".viewed").prop("disabled", false);
227                             $(event.target).siblings(".new").prop("disabled", false);
228                             $(event.target).prop("disabled", true);
229                         }
230                     } else {
231                         $("#error").text(_("Unable to change status of problem report."));
232                         $("#error").show();
233                     }
234                 })
235                 .error(function(data){
236                     $("#error").text(_("Unable to change status of problem report."));
237                     $("#error").show();
238                 });
239             });
240         });
241     </script>
242 [% END %]
243
244 [% INCLUDE 'intranet-bottom.inc' %]