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