Bug 12561: Add warning on about page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / checkout-notes.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Checkout notes &rsaquo; Circulation &rsaquo; Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="circ_checkout-notes" class="circ">
13
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'circ-search.inc' %]
16
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
18     <ol>
19         <li>
20             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21         </li>
22         <li>
23             <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
24         </li>
25         <li>
26             <a href="#" aria-current="page">
27                 Checkout notes
28             </a>
29         </li>
30     </ol>
31 </nav>
32
33 <div class="main container-fluid">
34     <div class="row">
35         <div class="col-sm-12">
36             <main>
37                 <div class="row">
38
39                 [% IF Koha.Preference('CircSidebar') %]
40                     <div class="col-sm-10 col-sm-push-2">
41                 [% ELSE %]
42                     <div class="col-md-12 col-lg-10 col-lg-offset-1">
43                 [% END %]
44
45             <h1>Checkout notes</h1>
46
47             <div class="dialog alert" id="error" style="display:none;"></div>
48
49             [% IF ( selected_count ) %]
50                 <div class="dialog message">
51                     [% IF ( action == 'seen' ) %]
52                         <span>[% selected_count | html %] note(s) marked as seen.</span>
53                     [% ELSIF ( action == 'notseen' ) %]
54                         <span>[% selected_count | html %] note(s) marked as not seen.</span>
55                     [% ELSE %]
56                         <span>Failed to change the status of [% selected_count | html %] item(s).</span>
57                     [% END %]
58                 </div>
59             [% END %]
60
61             [% IF ( notes.count ) %]
62                 <form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
63                     <div id="toolbar" class="btn-toolbar">
64                         <button type="submit" class="btn btn-default markseen" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
65                         <button type="submit" class="btn btn-default markseen" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
66                     </div>
67
68                     <fieldset class="action" style="cursor:pointer;">
69                         <a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
70                         | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
71                         | <a class="HideSeen"><i class="fa fa-minus-square"></i> Hide seen</a>
72                         | <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
73                     </fieldset>
74
75                     <table id="notestable">
76                         <thead>
77                             <tr>
78                                 <th class="NoSort">&nbsp;</th>
79                                 <th class="anti-the">Title</th>
80                                 <th>Note</th>
81                                 <th>Date</th>
82                                 <th>Set by</th>
83                                 <th>Status</th>
84                                 <th class="NoSort noExport">Actions</th>
85                             </tr>
86                         </thead>
87                         <tbody>
88                             [% FOREACH note IN notes %]
89                                 <tr>
90                                     <td><input type="checkbox" name="issue_ids" value="[% note.issue_id | html %]"></td>
91                                     <td>[% note.item.biblio.title | html %] - [% note.item.biblio.author | html %] (<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% note.item.biblionumber | uri %]">[% note.item.barcode | html %]</a>)</td>
92                                     <td>[% note.note | html %]</td>
93                                     <td data-order="[% note.notedate | html %]">[% note.notedate | $KohaDates %]</td>
94                                     <td>[% INCLUDE 'patron-title.inc' patron => note.patron hide_patron_infos_if_needed=1 %]</td>
95                                     <td class="seen[% note.noteseen | html %]">
96                                         [% IF ( note.noteseen == 0 ) %]
97                                             <span id="status_[% note.issue_id | html %]">Not seen</span>
98                                         [% ELSIF ( note.noteseen == 1 ) %]
99                                             <span id="status_[% note.issue_id | html %]">Seen</span>
100                                         [% END %]
101                                     </td>
102                                     <td class="actions">
103                                         [% IF ( note.noteseen == 1 ) %]
104                                             <button name="seen" data-issue_id="[% note.issue_id | html %]" class="seen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id | html %]" class="notseen btn btn-default btn-xs"><i class="fa fa-eye-slash"></i> Mark not seen</button>
105                                         [% ELSIF ( note.noteseen == 0 ) %]
106                                             <button name="seen" data-issue_id="[% note.issue_id | html %]" class="seen btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id | html %]" class="notseen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
107                                         [% END %]
108                                     </td>
109                                 </tr>
110                             [% END %]
111                         </tbody>
112                     </table>
113
114                 </form>
115
116             [% ELSE %]
117                 <div class="dialog message">There are currently no checkout notes.</div>
118             [% END %] <!-- notes -->
119
120                     [% IF Koha.Preference('CircSidebar') %]
121                         </div> <!-- /.col-sm-10.col-sm-push-2 -->
122                         <div class="col-sm-2 col-sm-pull-10">
123                             <aside>
124                                 [% INCLUDE 'circ-nav.inc' %]
125                             </aside>
126                         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
127                     [% ELSE %]
128                         </div> <!-- .col-md-12.col-lg-10.col-lg-offset-1 -->
129                     [% END %]
130
131                 </div> <!-- /.row -->
132             </main>
133         </div> <!-- /.col-sm-12 -->
134     </div> <!-- /.row -->
135
136 [% MACRO jsinclude BLOCK %]
137     [% INCLUDE 'calendar.inc' %]
138     [% INCLUDE 'datatables.inc' %]
139     <script>
140         $(document).ready(function(){
141             $("#notestable").dataTable($.extend(true, {}, dataTablesDefaults, {
142                 "order": [[ 1, "asc" ]],
143                 "aoColumnDefs": [
144                     { "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
145                     { "type": "anti-the", "targets": [ "anti-the" ] }
146                 ],
147                 "pagingType": "full"
148             }));
149
150             $(".SelectAll").on("click", function(){
151                 $("input[name='issue_ids'][type='checkbox']").prop("checked", true);
152                 $(".markseen").prop("disabled", false);
153             });
154
155             $(".ClearAll").on("click", function(){
156                 $("input[name='issue_ids'][type='checkbox']").prop("checked", false);
157                 $(".markseen").prop("disabled", true);
158             });
159
160             $(".HideSeen").on("click", function(){
161                 $(".seen1").parent().hide();
162             });
163
164             $(".ShowAll").on("click", function(){
165                 $("tr").show();
166             });
167
168             $("#error").hide();
169
170             $("#notestable").on("change", "input[type='checkbox']", function(){
171                 if ( $("input[type='checkbox']").is(":checked") ) {
172                     $(".markseen").prop("disabled", false);
173                 } else {
174                     $(".markseen").prop("disabled", true);
175                 }
176             });
177
178             $("#notestable").on("click", "button.seen, button.notseen", function(event){
179                 event.preventDefault(); // prevent form submission
180                 var $action = $(this).attr("name");
181                 var $issue_id = $(this).data('issue_id');
182                 var ajaxData = {
183                     'action': $action,
184                     'issue_id': $issue_id,
185                 };
186
187                 $.ajax({
188                     url: '/cgi-bin/koha/svc/checkout_notes/',
189                     type: 'POST',
190                     dataType: 'json',
191                     data: ajaxData,
192                 })
193
194                 .done(function(data){
195                     if (data.status == 'success'){
196                         if ( $action == 'notseen' ){
197                             $("#status_" + $issue_id).text(_("Not seen"));
198                             $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0");
199                             $(event.target).siblings(".seen").prop("disabled", false);
200                             $(event.target).prop("disabled", true);
201                         } else {
202                             $("#status_" + $issue_id).text(_("Seen"));
203                             $(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1");
204                             $(event.target).siblings(".notseen").prop("disabled", false);
205                             $(event.target).prop("disabled", true);
206                         }
207                     } else {
208                         $("#error").text(_("Unable to change status of note."));
209                         $("#error").show();
210                     }
211                 })
212                 .error(function(data){
213                     $("#error").text(_("Unable to change status of note."));
214                     $("#error").show();
215                 });
216             });
217         });
218     </script>
219 [% END %]
220
221 [% INCLUDE 'intranet-bottom.inc' %]