Bug 27846: (follow-up) Add id back to breadcrumbs container
[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
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">
26                 OPAC problem reports
27             </a>
28         </li>
29     </ol>
30 </nav>
31
32 <div class="main container-fluid">
33     <div class="row">
34         <div class="col-sm-10 col-sm-push-2">
35             <main>
36
37             <h1>OPAC problem reports</h1>
38
39             <div class="dialog alert" id="error" style="display:none;"></div>
40
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>
49                     [% ELSE %]
50                         <span>Failed to change the status of [% selected_count | html %] problem report(s).</span>
51                     [% END %]
52                 </div>
53             [% END %]
54
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>
61                     </div>
62
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>
70                     </fieldset>
71
72                     <table id="problemreportstable">
73                         <thead>
74                             <tr>
75                                 <th class="NoSort">&nbsp;</th>
76                                 <th class="anti-the">Message</th>
77                                 <th>Problem page</th>
78                                 <th>Sent to</th>
79                                 <th class="title-string">Created on</th>
80                                 <th>Set by</th>
81                                 <th>Status</th>
82                                 <th class="NoSort noExport">Actions</th>
83                             </tr>
84                         </thead>
85                         <tbody>
86                             [% FOREACH report IN problem_reports %]
87                                 <tr>
88                                     <td><input type="checkbox" name="report_ids" value="[% report.reportid | html %]"></td>
89                                     <td>
90                                         <strong>[% report.title | html %]</strong><br>
91                                         [% report.content | html %]
92                                     </td>
93                                     <td><a href="[% OPACBaseURL | url %][% report.problempage | url %]">[% OPACBaseURL | url %][% report.problempage | html %]</a></td>
94                                     <td>
95                                         [% SWITCH report.recipient %]
96                                         [% CASE 'admin' %]Koha administrator
97                                         [% CASE 'library' %]A librarian
98                                         [% END %]
99                                     </td>
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 %]
105                                             [% CASE 'New' %]New
106                                             [% CASE 'Closed' %]Closed
107                                             [% CASE 'Viewed' %]Viewed
108                                             [% CASE %]Unknown status ([% report.status | html %])
109                                             [% END %]
110                                         </span>
111                                     </td>
112                                     <td class="actions">
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>
117                                         [% ELSE %]
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>
119                                         [% END %]
120                                     </td>
121                                 </tr>
122                             [% END %]
123                         </tbody>
124                     </table>
125
126                 </form>
127
128             [% ELSE %]
129                 <div class="dialog message">There are currently no problem reports.</div>
130             [% END %] <!-- problem reports -->
131
132             </main>
133         </div> <!-- /.col-sm-10.col-sm-push-2 -->
134
135         <div class="col-sm-2 col-sm-pull-10">
136             <aside>
137                 [% INCLUDE 'tools-menu.inc' %]
138             </aside>
139         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
140
141     </div> <!-- /.row -->
142
143 [% MACRO jsinclude BLOCK %]
144     [% INCLUDE 'calendar.inc' %]
145     [% INCLUDE 'datatables.inc' %]
146     <script>
147         $(document).ready(function(){
148             $("#problemreportstable").dataTable($.extend(true, {}, dataTablesDefaults, {
149                 "order": [[ 1, "asc" ]],
150                 "aoColumnDefs": [
151                     { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
152                     { "type": "title-string", "targets" : [ "title-string" ] },
153                     { "type": "anti-the", "targets": [ "anti-the" ] }
154                 ],
155                 "pagingType": "full"
156             }));
157
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);
163             });
164
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);
170             });
171
172
173
174             $(".HideViewed").on("click", function(){
175                 $(".statusViewed").parent().hide();
176             });
177
178             $(".HideClosed").on("click", function(){
179                 $(".statusClosed").parent().hide();
180             });
181
182             $(".HideNew").on("click", function(){
183                 $(".statusNew").parent().hide();
184             });
185
186             $(".ShowAll").on("click", function(){
187                 $("tr").show();
188             });
189
190             $("#error").hide();
191
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);
197                 } else {
198                     $(".markviewed").prop("disabled", true);
199                     $(".markclosed").prop("disabled", true);
200                     $(".marknew").prop("disabled", true);
201                 }
202             });
203
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');
208                 var ajaxData = {
209                     'action': $action,
210                     'report_id': $report_id,
211                 };
212
213                 $.ajax({
214                     url: '/cgi-bin/koha/svc/problem_reports/',
215                     type: 'POST',
216                     dataType: 'json',
217                     data: ajaxData,
218                 })
219
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);
234                         } else {
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);
240                         }
241                     } else {
242                         $("#error").text(_("Unable to change status of problem report."));
243                         $("#error").show();
244                     }
245                 })
246                 .error(function(data){
247                     $("#error").text(_("Unable to change status of problem report."));
248                     $("#error").show();
249                 });
250             });
251         });
252     </script>
253 [% END %]
254
255 [% INCLUDE 'intranet-bottom.inc' %]