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