Bug 24387: Rename "News" with "Additional contents"
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sci / sci-main.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [%# Includes %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% USE AdditionalContents %]
7 [%# Helper template functions %]
8 [% BLOCK error_message %]
9     [% IF messages.BadBarcode %]
10         <span>(Barcode not found on the database, please see library staff for assistance)</span>
11     [% ELSIF messages.Wrongbranch %]
12         <span>(The item cannot be checked in at this library, please see library staff for assistance)</span>
13     [% ELSIF messages.withdrawn %]
14         <span>(Item is withdrawn and check-in blocked by policy, please see library staff for assistance)</span>
15     [% ELSIF messages.NotIssued %]
16         <span>(The book is not currently on loan, please see library staff for assistance)</span>
17     [% ELSIF messages.additional_materials %]
18         <span>(The item cannot be checked in at a self service terminal, please see library staff for assistance)</span>
19     [% ELSE %]
20         <span>(There was a problem checking in this item, please see library staff for assistance)</span>
21     [% END %]
22 [% END %]
23 [% INCLUDE 'doc-head-open.inc' %]
24 [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
25 <title>Self check-in &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %]</title>
26
27 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28 <meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
29
30 [% IF ( Koha.Preference('OpacFavicon') ) %]
31     <link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" />
32 [% ELSE %]
33     <link rel="shortcut icon" href="[% interface | html %]/[% theme | html %]/images/favicon.ico" type="image/x-icon" />
34 [% END %]
35 [% IF ( bidi ) %]
36     [% Asset.css("lib/jquery/jquery-ui-rtl-1.12.1.min.css") | $raw %]
37     [% Asset.css("css/sco-rtl.css") | $raw %]
38 [% ELSE %]
39     [% Asset.css("lib/jquery/jquery-ui-1.12.1.css") | $raw %]
40     [% Asset.css("css/sco.css") | $raw %]
41 [% END %]
42 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
43 [% IF ( Koha.Preference('SelfCheckInUserCSS') ) %]<style>[% Koha.Preference('SelfCheckInUserCSS') | $raw %]</style>[% END %]
44 <script>
45     function _(s) { return s } // dummy function for gettext
46 </script>
47 [% Asset.js("lib/modernizr.min.js") | $raw %]
48 </head>
49 <body id="sci_main" class="sci" onload="dofocus();" onunload="mungeHistory();">
50     [% INCLUDE 'masthead-sci.inc' %]
51
52     <div class="main">
53         <div class="container-fluid">
54             <div class="row">
55                 <div class="col order-first order-md-first order-lg-2">
56                     <div id="masthead">
57                         <h1>[% LibraryName | html %] Self check-in</h1>
58                     </div>
59
60                     [% IF ( nopermission ) %]
61                         [%# This is what is displayed if user doesn't have permission %]
62                         <div class="alert alert-warning">
63                             <h2>Access denied</h2>
64                             <p>Sorry, this self check-in station has lost authentication. Please contact the administrator to resolve this problem.</p>
65                         </div>
66                     [% ELSIF ( different_ip ) %]
67                         [%# This is what is displayed if user doesn't have permission %]
68                         <div class="alert alert-warning">
69                             <h2>Session lost</h2>
70                             <p>You are accessing self check-in from a different IP address! Please log in again.</p>
71                         </div>
72                     [% ELSIF ( checkins ) %]
73                         [%# We have results from a check-in attempt %]
74                         <div id="checkins" class="sci_results_list">
75                             [% IF ( success && success.size > 0 || errors && errors.size > 0 ) %]
76                                     <table id="sci_bcheckins_table" class="table table-bordered table-striped dataTable no-footer">
77                                         <caption><h2>Results</h2></caption>
78                                         <thead>
79                                             <th>Barcode</th>
80                                             <th>Status</th>
81                                         </thead>
82                                         <tbody>
83                                             [% FOREACH success_line IN success %]
84                                                 <tr>
85                                                     <td>[% success_line.barcode | html %]</td>
86                                                     <td>Checked in</td>
87                                                 </tr>
88                                             [% END %]
89                                             [% FOREACH error IN errors %]
90                                                 <tr>
91                                                     <td>[% error.barcode | html %]</td>
92                                                     <td>Not checked in [% PROCESS error_message messages=error.messages %]</td>
93                                                 </tr>
94                                             [% END %]
95                                         </tbody>
96                                     </table>
97                                     <div>
98                                         <form method="post" action="#" id="finish_form">
99                                             <legend class="sr-only">Finish</legend>
100                                             <button id="sci_finish_button" type="submit" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
101                                         </form>
102                                     </div>
103                             [% ELSE %]
104                                 <div class="alert alert-warning">
105                                     <p>Your request included no check-ins.</p>
106                                 </div>
107                             [% END %]
108                         </div>
109                     [% ELSE %]
110                         [%# Prompt for barcodes %]
111                         <div id="new_checkins" class="sci_entry">
112                             <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sci/sci-main.pl">
113                                 <legend class="sr-only">Scan</legend>
114                                 <div class="row">
115                                     <div class="col-auto">
116                                         <label for="barcode_input">Scan the item or enter its barcode:</label>
117                                     </div>
118                                     <div class="col-4">
119                                         <input id="barcode_input" name="barcode_input" size="20" type="text" class="focus form-control" autocomplete="off" />
120                                     </div>
121                                     <div class="col-auto">
122                                         <button id="sci_append_button" type="submit" class="btn btn-primary">
123                                             Submit
124                                         </button>
125                                     </div>
126                                 </div> <!-- /.row -->
127                                 <div class="row">
128                                     <div class="col">
129                                         <div class="sci_input_append">
130                                             <table id="sci_barcodes_table" class="table table-bordered table-striped dataTable no-footer" style="display: none;">
131                                                 <caption class="sr-only">Barcodes</caption>
132                                                 <thead>
133                                                     <th class="barcodes_column">Barcode</th>
134                                                 </thead>
135                                                 <tbody>
136                                                 </tbody>
137                                             </table> <!-- /#sci_barcodes_table -->
138                                         </div> <!-- .sci_input_append -->
139                                         <input type="hidden" name="op" value="check_in" />
140                                         <div id="button_bar">
141                                             <button id="sci_checkin_button" type="submit" class="btn btn-primary" style="display: none;">
142                                                 <i class="fa fa-check-square-o" aria-hidden="true"></i> <span>Check in</span>
143                                             </button>
144                                             <a href="/cgi-bin/koha/sci/sci-main.pl" class="btn btn-danger" role="button" style="display: none;" id="sci_refresh_button">
145                                                 <i class="fa fa-times" aria-hidden="true"></i> <span>Cancel</span>
146                                             </a>
147                                         </div> <!-- /#button_bar -->
148                                     </div> <!-- /.col -->
149                                 </div> <!-- /.row -->
150                             </form> <!-- /#scan_form -->
151                         </div> <!-- / #new_checkins -->
152                     [% END # /IF ( nopermission ) %]
153                 </div> <!-- / #masthead -->
154             </div> <!-- / .row -->
155         </div> <!-- / .container-fluid -->
156
157     [% IF ( Koha.Preference('SelfCheckInMainUserBlock') ) %]
158         <div id="SelfCheckInMainUserBlock">[% Koha.Preference('SelfCheckInMainUserBlock' ) | $raw %]</div>
159     [% END %]
160 </div> <!-- / .main -->
161
162 [% # Help modal %]
163 <div id="helpModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
164     <div class="modal-dialog">
165         <div class="modal-content">
166             <div class="modal-header">
167                 <h2 id="helpModalLabel">Self check-in help</h2>
168                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
169                     <span aria-hidden="true">&times;</span>
170                 </button>
171             </div> <!-- /.modal-header -->
172             <div class="modal-body">
173                 <ul>
174                     <li>Scan each item or enter its barcode. A list with the entered barcodes will be displayed.</li>
175                     <li>Click the 'Check in' button to confirm.</li>
176                     <li>The operation results will be displayed for each entered barcode.</li>
177                     <li>The 'Finish' button is presented to start over.</li>
178                     <li>At any step, clicking the 'Cancel' button will erase the scanned barcodes and start over.</li>
179                 </ul>
180             </div> <!-- /.modal-body -->
181             <div class="modal-footer">
182                 <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
183             </div>
184         </div> <!-- /.modal-content -->
185     </div> <!-- /.modal-dialog -->
186 </div> <!-- /#helpModal -->
187
188 </body>
189
190 [% INCLUDE 'opac-bottom.inc' %]
191 [% BLOCK jsinclude %]
192     <script>
193
194         function mungeHistory() {
195             // prevent back button from allowing form resubmission
196             if (history && history.pushState) {
197                 history.replaceState(null, document.title, window.location.href);
198             }
199         }
200
201         function dofocus() {
202             $(".focus:last").select();
203         }
204
205         var barcodes = [];
206
207         $(document).ready(function() {
208             // Barcodes scanning table initially hidden
209             $("#sci_barcodes_table").hide();
210             // Control de 'append' button behaviour
211             $("#sci_append_button").on('click',function( e ){
212                 // Make sure the form is not submitted by the button
213                 e.preventDefault();
214                 var barcode = $('#barcode_input').val();
215                 //var result  = validate_barcode( barcode );
216                 $('#sci_barcodes_table tbody').append(
217                         '<tr style="font-size: initial;"><td>' +
218                             barcode +
219                             '<input type="hidden" name="barcode" value="' + barcode + '" />' +
220                         '</td></tr>' );
221                 // Make sure the table is now displayed
222                 $("#sci_barcodes_table").show();
223                 $('#sci_checkin_button').show();
224                 $('#sci_refresh_button').show();
225                 barcodes.push(barcode);
226                 // clean the input, reset the focus
227                 $('#barcode_input').val('');
228                 dofocus();
229             });
230
231             $(".helpModal-trigger").on("click",function(e){
232                 e.preventDefault();
233                 $("#helpModal").modal("show");
234             });
235
236             // set focus at the beginning
237             dofocus();
238         });
239
240         var idleTime = 0;
241         $(document).ready(function () {
242             //Increment the idle time counter every second
243             var idleInterval = setInterval(timerIncrement, 1000);
244
245             //Zero the idle timer on mouse movement.
246             $(this).mousemove(function (e) {
247                 idleTime = 0;
248             });
249             $(this).keypress(function (e) {
250                 idleTime = 0;
251             });
252         });
253
254         function timerIncrement() {
255             if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) {
256                 idleTime = idleTime + 1;
257                 idleTimeout = [% refresh_timeout | html %];
258                 if (idleTime >= idleTimeout ) {
259                     location.href = '/cgi-bin/koha/sci/sci-main.pl';
260                 }
261             }
262         }
263     </script>
264
265     [% IF ( Koha.Preference('SelfCheckInUserJS') ) %]
266         <script>[% Koha.Preference('SelfCheckInUserJS') | $raw %]</script>
267     [% END %]
268 [% END %]