cd02e656125b0d9b0d6af831b00733a4e3982ed8
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / checkout-notes.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Home &rsaquo; Circulation &rsaquo; Checkout notes</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% Asset.css("css/datatables.css") %]
10 </head>
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'circ-search.inc' %]
13 <div id="breadcrumbs">
14     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
15     <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
16     Checkout notes
17 </div>
18
19 [% IF Koha.Preference('CircSidebar') %]<div id="doc3" class="yui-t2">[% ELSE %]<div id="doc" class="yui-t7">[% END %]
20     <div id="bd">
21         <div id="yui-main">
22         [% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
23
24             <h1>Checkout notes</h1>
25
26             <div class="dialog alert" id="error"></div>
27
28             [% IF ( selected_count ) %]
29                 <div class="dialog message">
30                     [% IF ( action == 'seen' ) %]
31                         <span>[% selected_count %] note(s) marked as seen.</span>
32                     [% ELSIF ( action == 'notseen' ) %]
33                         <span>[% selected_count %] note(s) marked as not seen.</span>
34                     [% ELSE %]
35                         <span>Failed to change the status of [% selected_count %] item(s).</span>
36                     [% END %]
37                 </div>
38             [% END %]
39
40             [% IF ( notes.count ) %]
41                 <fieldset class="action">
42                     <a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
43                 </fieldset>
44
45                 <form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
46
47                     <table id="notestable">
48                         <thead>
49                             <tr>
50                                 <th>&nbsp;</th>
51                                 <th>Title</th>
52                                 <th>Note</th>
53                                 <th>Date</th>
54                                 <th>Set by</th>
55                                 <th>Status</th>
56                                 <th>Actions</th>
57                             </tr>
58                         </thead>
59                         <tbody>
60                             [% FOREACH note IN notes %]
61                                 <tr>
62                                     <td><input type="checkbox" name="issue_ids" value="[% note.issue_id %]"></td>
63                                     <td>[% note.item.biblio.title %] - [% note.item.biblio.author %] (<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% note.item.biblionumber %]">[% note.item.barcode %]</a>)</td>
64                                     <td>[% note.note | html %]</td>
65                                     <td>[% note.notedate | $KohaDates %]</td>
66                                     <td>[% INCLUDE 'patron-title.inc' patron => note.patron hide_patron_infos_if_needed=1 %]</td>
67                                     <td>
68                                         [% IF ( note.noteseen == 0 ) %]
69                                             <span id="status_[% note.issue_id %]">Not seen</span>
70                                         [% ELSIF ( note.noteseen == 1 ) %]
71                                             <span id="status_[% note.issue_id %]">Seen</span>
72                                         [% END %]
73                                     </td>
74                                     <td class="actions">
75                                         [% IF ( note.noteseen == 1 ) %]
76                                             <button name="seen" data-issue_id="[% note.issue_id %]" 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 %]" class="notseen btn btn-default btn-xs"><i class="fa fa-eye-slash"></i> Mark not seen</button>
77                                         [% ELSIF ( note.noteseen == 0 ) %]
78                                             <button name="seen" data-issue_id="[% note.issue_id %]" 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 %]" class="notseen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
79                                         [% END %]
80                                     </td>
81                                 </tr>
82                             [% END %]
83                         </tbody>
84                     </table>
85
86                     <fieldset class="action">
87                         <button type="submit" class="btn btn-default btn-sm" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
88                         <button type="submit" class="btn btn-default btn-sm" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
89                     </fieldset>
90
91                 </form>
92
93             [% ELSE %]
94                 <span>There are currently no checkout notes.</span>
95             [% END %] <!-- notes -->
96
97         </div> <!-- yui-main -->
98
99         [% IF Koha.Preference('CircSidebar') %]
100         </div>
101
102         <div class="yui-b noprint">
103             [% INCLUDE 'circ-nav.inc' %]
104         </div>
105         [% END %]
106
107     </div> <!-- bd -->
108 </div> <!-- doc3 -->
109
110 [% MACRO jsinclude BLOCK %]
111     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
112     [% INCLUDE 'calendar.inc' %]
113     [% INCLUDE 'datatables.inc' %]
114     <script type="text/javascript">
115     //<![CDATA[
116         $(document).ready(function(){
117             $("#notestable").dataTable($.extend(true, {}, dataTablesDefaults, {
118                 "aoColumnDefs": [
119                     { "aTargets": [ 0, -1 ], "bSearchable": false, "bSortable": false },
120                 ],
121                 "sPaginationType": "four_button"
122             }));
123
124             $(".SelectAll").on("click", function(){
125                 $("input[name='issue_ids'][type='checkbox']").prop("checked", true);
126                 $(".btn-sm").prop("disabled", false);
127             });
128
129             $(".ClearAll").on("click", function(){
130                 $("input[name='issue_ids'][type='checkbox']").prop("checked", false);
131                 $(".btn-sm").prop("disabled", true);
132             });
133
134             $("#error").hide();
135
136             $("input[type='checkbox']").click(function(event){
137                 if ( $("input[type='checkbox']").is(":checked") ) {
138                     $(".btn-sm").prop("disabled", false);
139                 } else {
140                     $(".btn-sm").prop("disabled", true);
141                 }
142             });
143
144             $(".btn-xs").click(function(event){
145                 event.preventDefault(); // prevent form submission
146                 var $action = $(this).attr("name");
147                 var $issue_id = $(this).data('issue_id');
148                 var ajaxData = {
149                     'action': $action,
150                     'issue_id': $issue_id,
151                 };
152
153                 $.ajax({
154                     url: '/cgi-bin/koha/svc/checkout_notes/',
155                     type: 'POST',
156                     dataType: 'json',
157                     data: ajaxData,
158                 })
159
160                 .done(function(data){
161                     if (data.status == 'success'){
162                         if ( $action == 'notseen' ){
163                             $("#status_" + $issue_id).text(_("Not seen"));
164                             $(event.target).siblings(".seen").prop("disabled", false);
165                             $(event.target).prop("disabled", true);
166                         } else {
167                             $("#status_" + $issue_id).text(_("Seen"));
168                             $(event.target).siblings(".notseen").prop("disabled", false);
169                             $(event.target).prop("disabled", true);
170                         }
171                     } else {
172                         $("#error").text(_("Unable to change status of note."));
173                         $("#error").show();
174                     }
175                 });
176             });
177         });
178     //]]>
179     </script>
180 [% END %]
181
182 [% INCLUDE 'intranet-bottom.inc' %]