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