Bug 35241: Fix markup errors in point of sale template
[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 [% PROCESS 'i18n.inc' %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9     [% t("OPAC problem reports") | html %] &rsaquo;
10     [% t("Tools") | html %] &rsaquo;
11     [% t("Koha") | html %]
12 [% END %]</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="tools_problem-reports" class="tools">
17
18 [% WRAPPER 'header.inc' %]
19     [% INCLUDE 'prefs-admin-search.inc' %]
20 [% END %]
21
22 [% WRAPPER 'sub-header.inc' %]
23     [% WRAPPER breadcrumbs %]
24         [% WRAPPER breadcrumb_item %]
25             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
26         [% END %]
27         [% WRAPPER breadcrumb_item bc_active= 1 %]
28             <span>OPAC problem reports</span>
29         [% END %]
30     [% END #/ WRAPPER breadcrumbs %]
31 [% END #/ WRAPPER sub-header.inc %]
32
33 <div class="main container-fluid">
34     <div class="row">
35         <div class="col-sm-10 col-sm-push-2">
36             <main>
37
38             <h1>OPAC problem reports</h1>
39
40             <div class="dialog alert" id="error" style="display:none;"></div>
41
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>
50                     [% ELSE %]
51                         <span>Failed to change the status of [% selected_count | html %] problem report(s).</span>
52                     [% END %]
53                 </div>
54             [% END %]
55
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>
62                     </div>
63
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>
71                     </div>
72
73                     <table id="problemreportstable">
74                         <thead>
75                             <tr>
76                                 <th class="NoSort">&nbsp;</th>
77                                 <th class="anti-the">Message</th>
78                                 <th>Problem page</th>
79                                 <th>Sent to</th>
80                                 <th>Created on</th>
81                                 <th>Set by</th>
82                                 <th>Status</th>
83                                 <th class="NoSort noExport">Actions</th>
84                             </tr>
85                         </thead>
86                         <tbody>
87                             [% FOREACH report IN problem_reports %]
88                                 <tr>
89                                     <td><input type="checkbox" name="report_ids" value="[% report.reportid | html %]"></td>
90                                     <td>
91                                         <strong>[% report.title | html %]</strong><br>
92                                         [% report.content | html %]
93                                     </td>
94                                     <td><a href="[% OPACBaseURL | url %][% report.problempage | url %]">[% OPACBaseURL | url %][% report.problempage | html %]</a></td>
95                                     <td>
96                                         [% SWITCH report.recipient %]
97                                         [% CASE 'admin' %]<span>Koha administrator</span>
98                                         [% CASE 'library' %]<span>A librarian</span>
99                                         [% END %]
100                                     </td>
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>
110                                             [% END %]
111                                         </span>
112                                     </td>
113                                     <td class="actions">
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>
118                                         [% ELSE %]
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>
120                                         [% END %]
121                                     </td>
122                                 </tr>
123                             [% END %]
124                         </tbody>
125                     </table>
126
127                 </form>
128
129             [% ELSE %]
130                 <div class="dialog message">There are currently no problem reports.</div>
131             [% END %] <!-- problem reports -->
132
133             </main>
134         </div> <!-- /.col-sm-10.col-sm-push-2 -->
135
136         <div class="col-sm-2 col-sm-pull-10">
137             <aside>
138                 [% INCLUDE 'tools-menu.inc' %]
139             </aside>
140         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
141
142     </div> <!-- /.row -->
143
144 [% MACRO jsinclude BLOCK %]
145     [% INCLUDE 'calendar.inc' %]
146     [% INCLUDE 'datatables.inc' %]
147     <script>
148         $(document).ready(function(){
149             $("#problemreportstable").dataTable($.extend(true, {}, dataTablesDefaults, {
150                 "order": [[ 1, "asc" ]],
151                 "aoColumnDefs": [
152                     { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
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' %]