|
Lines 25-35
Link Here
|
| 25 |
[% SET SelfCheckInMainUserBlock = AdditionalContents.get( location => "SelfCheckInMainUserBlock", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] |
25 |
[% SET SelfCheckInMainUserBlock = AdditionalContents.get( location => "SelfCheckInMainUserBlock", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] |
| 26 |
[% INCLUDE 'doc-head-open.inc' %] |
26 |
[% INCLUDE 'doc-head-open.inc' %] |
| 27 |
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] |
27 |
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] |
| 28 |
<title>Self check-in › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha[% END %]</title> |
28 |
<title>Self check-in › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %]</title> |
| 29 |
|
29 |
|
| 30 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
30 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 31 |
<meta name="generator" content="Koha" /> |
31 |
<meta name="generator" content="Koha" /> <!-- leave this for stats --> |
| 32 |
<!-- leave this for stats --> |
|
|
| 33 |
|
32 |
|
| 34 |
[% IF ( Koha.Preference('OpacFavicon') ) %] |
33 |
[% IF ( Koha.Preference('OpacFavicon') ) %] |
| 35 |
<link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" /> |
34 |
<link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" /> |
|
Lines 44-71
Link Here
|
| 44 |
[% ELSE %] |
43 |
[% ELSE %] |
| 45 |
[% Asset.css("css/sco.css") | $raw %] |
44 |
[% Asset.css("css/sco.css") | $raw %] |
| 46 |
[% END %] |
45 |
[% END %] |
| 47 |
[% IF ( Koha.Preference('OPACUserCSS') ) %] |
46 |
[% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %] |
| 48 |
<!-- prettier-ignore-start --> |
|
|
| 49 |
<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style> |
| 50 |
<!-- prettier-ignore-end --> |
| 51 |
[% END %] |
| 52 |
[% IF Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) %] |
47 |
[% IF Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) %] |
| 53 |
<!-- prettier-ignore-start --> |
|
|
| 54 |
<style> |
48 |
<style> |
| 55 |
[% Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) | $raw %] |
49 |
[% Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) | $raw %] |
| 56 |
</style> |
50 |
</style> |
| 57 |
<!-- prettier-ignore-end --> |
|
|
| 58 |
[% END %] |
| 59 |
[% IF ( Koha.Preference('SelfCheckInUserCSS') ) %] |
| 60 |
<!-- prettier-ignore-start --> |
| 61 |
<style>[% Koha.Preference('SelfCheckInUserCSS') | $raw %]</style> |
| 62 |
<!-- prettier-ignore-end --> |
| 63 |
[% END %] |
51 |
[% END %] |
|
|
52 |
[% IF ( Koha.Preference('SelfCheckInUserCSS') ) %]<style>[% Koha.Preference('SelfCheckInUserCSS') | $raw %]</style>[% END %] |
| 64 |
<script> |
53 |
<script> |
| 65 |
var Koha = {}; |
54 |
var Koha = {}; |
| 66 |
function _(s) { |
55 |
function _(s) { return s } // dummy function for gettext |
| 67 |
return s; |
|
|
| 68 |
} // dummy function for gettext |
| 69 |
</script> |
56 |
</script> |
| 70 |
[% IF lang && lang != 'en' %] |
57 |
[% IF lang && lang != 'en' %] |
| 71 |
[% Asset.js(lang _ '/js/locale_data.js') | $raw %] |
58 |
[% Asset.js(lang _ '/js/locale_data.js') | $raw %] |
|
Lines 74-203
Link Here
|
| 74 |
[% Asset.js('js/i18n.js') | $raw %] |
61 |
[% Asset.js('js/i18n.js') | $raw %] |
| 75 |
</head> |
62 |
</head> |
| 76 |
<body id="sci_main" class="sci"> |
63 |
<body id="sci_main" class="sci"> |
| 77 |
[% INCLUDE 'masthead-sci.inc' %] |
64 |
[% INCLUDE 'masthead-sci.inc' %] |
| 78 |
|
65 |
|
| 79 |
<div class="main"> |
66 |
<div class="main"> |
| 80 |
<div class="container-fluid"> |
67 |
<div class="container-fluid"> |
| 81 |
<div class="row"> |
68 |
<div class="row"> |
| 82 |
<div class="col order-first order-md-first order-lg-2"> |
69 |
<div class="col order-first order-md-first order-lg-2"> |
| 83 |
<div id="masthead"> |
70 |
<div id="masthead"> |
| 84 |
<h1>[% LibraryName | html %] Self check-in</h1> |
71 |
<h1>[% LibraryName | html %] Self check-in</h1> |
| 85 |
</div> |
|
|
| 86 |
|
| 87 |
[% IF ( nopermission ) %] |
| 88 |
[%# This is what is displayed if user doesn't have permission %] |
| 89 |
<div class="alert alert-warning"> |
| 90 |
<h2>Access denied</h2> |
| 91 |
<p>Sorry, this self check-in station has lost authentication. Please contact the administrator to resolve this problem.</p> |
| 92 |
</div> |
| 93 |
[% ELSIF ( different_ip ) %] |
| 94 |
[%# This is what is displayed if user doesn't have permission %] |
| 95 |
<div class="alert alert-warning"> |
| 96 |
<h2>Session lost</h2> |
| 97 |
<p>You are accessing self check-in from a different IP address! Please log in again.</p> |
| 98 |
</div> |
72 |
</div> |
| 99 |
[% ELSIF ( checkins ) %] |
73 |
|
| 100 |
[%# We have results from a check-in attempt %] |
74 |
[% IF ( nopermission ) %] |
| 101 |
<div id="checkins" class="sci_results_list"> |
75 |
[%# This is what is displayed if user doesn't have permission %] |
| 102 |
[% IF ( success && success.size > 0 || errors && errors.size > 0 ) %] |
76 |
<div class="alert alert-warning"> |
| 103 |
<table id="sci_bcheckins_table" class="table table-bordered table-striped dataTable no-footer"> |
77 |
<h2>Access denied</h2> |
| 104 |
<caption><h2>Results</h2></caption> |
78 |
<p>Sorry, this self check-in station has lost authentication. Please contact the administrator to resolve this problem.</p> |
| 105 |
<thead> |
79 |
</div> |
| 106 |
<th>Barcode</th> |
80 |
[% ELSIF ( different_ip ) %] |
| 107 |
<th>Status</th> |
81 |
[%# This is what is displayed if user doesn't have permission %] |
| 108 |
</thead> |
82 |
<div class="alert alert-warning"> |
| 109 |
<tbody> |
83 |
<h2>Session lost</h2> |
| 110 |
[% FOREACH success_line IN success %] |
84 |
<p>You are accessing self check-in from a different IP address! Please log in again.</p> |
| 111 |
<tr> |
85 |
</div> |
| 112 |
<td>[% success_line.barcode | html %]</td> |
86 |
[% ELSIF ( checkins ) %] |
| 113 |
<td>Checked in</td> |
87 |
[%# We have results from a check-in attempt %] |
| 114 |
</tr> |
88 |
<div id="checkins" class="sci_results_list"> |
| 115 |
[% END %] |
89 |
[% IF ( success && success.size > 0 || errors && errors.size > 0 ) %] |
| 116 |
[% FOREACH error IN errors %] |
90 |
<table id="sci_bcheckins_table" class="table table-bordered table-striped dataTable no-footer"> |
| 117 |
<tr> |
91 |
<caption><h2>Results</h2></caption> |
| 118 |
<td>[% error.barcode | html %]</td> |
92 |
<thead> |
| 119 |
<td>Not checked in [% PROCESS error_message messages=error.messages %]</td> |
93 |
<th>Barcode</th> |
| 120 |
</tr> |
94 |
<th>Status</th> |
| 121 |
[% END %] |
95 |
</thead> |
| 122 |
</tbody> |
96 |
<tbody> |
| 123 |
</table> |
97 |
[% FOREACH success_line IN success %] |
| 124 |
<div> |
98 |
<tr> |
| 125 |
<a href="/cgi-bin/koha/sci/sci-main.pl" id="sci_finish_button" class="btn btn-primary" role="button"><i class="fa fa-check" aria-hidden="true"></i> Finish</a> |
99 |
<td>[% success_line.barcode | html %]</td> |
| 126 |
</div> |
100 |
<td>Checked in</td> |
| 127 |
[% ELSE %] |
101 |
</tr> |
| 128 |
<div class="alert alert-warning"> |
102 |
[% END %] |
| 129 |
<p>Your request included no check-ins.</p> |
103 |
[% FOREACH error IN errors %] |
| 130 |
</div> |
104 |
<tr> |
| 131 |
[% END %] |
105 |
<td>[% error.barcode | html %]</td> |
| 132 |
</div> |
106 |
<td>Not checked in [% PROCESS error_message messages=error.messages %]</td> |
| 133 |
[% ELSE %] |
107 |
</tr> |
| 134 |
[%# Prompt for barcodes %] |
108 |
[% END %] |
| 135 |
<div id="new_checkins" class="sci_entry"> |
109 |
</tbody> |
| 136 |
<form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sci/sci-main.pl"> |
110 |
</table> |
| 137 |
[% INCLUDE 'csrf-token.inc' %] |
111 |
<div> |
| 138 |
<legend class="sr-only">Scan</legend> |
112 |
<a href="/cgi-bin/koha/sci/sci-main.pl" id="sci_finish_button" class="btn btn-primary" role="button"><i class="fa fa-check" aria-hidden="true"></i> Finish</a> |
| 139 |
<div class="row"> |
113 |
</div> |
| 140 |
<div class="col-auto"> |
114 |
[% ELSE %] |
| 141 |
<label for="barcode_input">Scan the item or enter its barcode:</label> |
115 |
<div class="alert alert-warning"> |
| 142 |
</div> |
116 |
<p>Your request included no check-ins.</p> |
| 143 |
<div class="col-4"> |
|
|
| 144 |
<input id="barcode_input" name="barcode_input" size="20" type="text" class="focus form-control" autocomplete="off" /> |
| 145 |
</div> |
| 146 |
<div class="col-auto"> |
| 147 |
<button id="sci_append_button" type="submit" class="btn btn-primary"> Submit </button> |
| 148 |
</div> |
117 |
</div> |
| 149 |
</div> |
118 |
[% END %] |
| 150 |
<!-- /.row --> |
119 |
</div> |
| 151 |
<div class="row"> |
120 |
[% ELSE %] |
| 152 |
<div class="col"> |
121 |
[%# Prompt for barcodes %] |
| 153 |
<div class="sci_input_append"> |
122 |
<div id="new_checkins" class="sci_entry"> |
| 154 |
<table id="sci_barcodes_table" class="table table-bordered table-striped dataTable no-footer" style="display: none;"> |
123 |
<form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sci/sci-main.pl"> |
| 155 |
<caption class="sr-only">Barcodes</caption> |
124 |
[% INCLUDE 'csrf-token.inc' %] |
| 156 |
<thead> |
125 |
<legend class="sr-only">Scan</legend> |
| 157 |
<th class="barcodes_column">Barcode</th> |
126 |
<div class="row"> |
| 158 |
</thead> |
127 |
<div class="col-auto"> |
| 159 |
<tbody> </tbody> |
128 |
<label for="barcode_input">Scan the item or enter its barcode:</label> |
| 160 |
</table> |
|
|
| 161 |
<!-- /#sci_barcodes_table --> |
| 162 |
</div> |
129 |
</div> |
| 163 |
<!-- .sci_input_append --> |
130 |
<div class="col-4"> |
| 164 |
<input type="hidden" name="op" value="cud-check_in" /> |
131 |
<input id="barcode_input" name="barcode_input" size="20" type="text" class="focus form-control" autocomplete="off" /> |
| 165 |
<div id="button_bar"> |
|
|
| 166 |
<button id="sci_checkin_button" type="submit" class="btn btn-primary" style="display: none;"> <i class="fa fa-check-square" aria-hidden="true"></i> <span>Check in</span> </button> |
| 167 |
<a href="/cgi-bin/koha/sci/sci-main.pl" class="btn btn-danger" role="button" style="display: none;" id="sci_refresh_button"> <i class="fa fa-times" aria-hidden="true"></i> <span>Cancel</span> </a> |
| 168 |
</div> |
132 |
</div> |
| 169 |
<!-- /#button_bar --> |
133 |
<div class="col-auto"> |
| 170 |
</div> |
134 |
<button id="sci_append_button" type="submit" class="btn btn-primary"> |
| 171 |
<!-- /.col --> |
135 |
Submit |
| 172 |
</div> |
136 |
</button> |
| 173 |
<!-- /.row --> |
137 |
</div> |
| 174 |
</form> |
138 |
</div> <!-- /.row --> |
| 175 |
<!-- /#scan_form --> |
139 |
<div class="row"> |
| 176 |
</div> |
140 |
<div class="col"> |
| 177 |
<!-- / #new_checkins --> |
141 |
<div class="sci_input_append"> |
| 178 |
[% END # /IF ( nopermission ) %] |
142 |
<table id="sci_barcodes_table" class="table table-bordered table-striped dataTable no-footer" style="display: none;"> |
| 179 |
|
143 |
<caption class="sr-only">Barcodes</caption> |
| 180 |
[% IF ( SelfCheckInMainUserBlock ) %] |
144 |
<thead> |
| 181 |
<div id="scimainuserblock"> [% PROCESS koha_news_block news => SelfCheckInMainUserBlock %] </div> |
145 |
<th class="barcodes_column">Barcode</th> |
| 182 |
[% END %] |
146 |
</thead> |
| 183 |
</div> |
147 |
<tbody> |
| 184 |
<!-- / #masthead --> |
148 |
</tbody> |
| 185 |
</div> |
149 |
</table> <!-- /#sci_barcodes_table --> |
| 186 |
<!-- / .row --> |
150 |
</div> <!-- .sci_input_append --> |
| 187 |
</div> |
151 |
<input type="hidden" name="op" value="cud-check_in" /> |
| 188 |
<!-- / .container-fluid --> |
152 |
<div id="button_bar"> |
| 189 |
</div> |
153 |
<button id="sci_checkin_button" type="submit" class="btn btn-primary" style="display: none;"> |
| 190 |
<!-- / .main --> |
154 |
<i class="fa fa-check-square" aria-hidden="true"></i> <span>Check in</span> |
| 191 |
|
155 |
</button> |
| 192 |
[%# Help modal %] |
156 |
<a href="/cgi-bin/koha/sci/sci-main.pl" class="btn btn-danger" role="button" style="display: none;" id="sci_refresh_button"> |
|
|
157 |
<i class="fa fa-times" aria-hidden="true"></i> <span>Cancel</span> |
| 158 |
</a> |
| 159 |
</div> <!-- /#button_bar --> |
| 160 |
</div> <!-- /.col --> |
| 161 |
</div> <!-- /.row --> |
| 162 |
</form> <!-- /#scan_form --> |
| 163 |
</div> <!-- / #new_checkins --> |
| 164 |
[% END # /IF ( nopermission ) %] |
| 165 |
|
| 166 |
[% IF ( SelfCheckInMainUserBlock ) %] |
| 167 |
<div id="scimainuserblock"> |
| 168 |
[% PROCESS koha_news_block news => SelfCheckInMainUserBlock %] |
| 169 |
</div> |
| 170 |
[% END %] |
| 171 |
</div> <!-- / #masthead --> |
| 172 |
</div> <!-- / .row --> |
| 173 |
</div> <!-- / .container-fluid --> |
| 174 |
|
| 175 |
</div> <!-- / .main --> |
| 176 |
|
| 177 |
[% # Help modal %] |
| 193 |
<div id="helpModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true"> |
178 |
<div id="helpModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true"> |
| 194 |
<div class="modal-dialog"> |
179 |
<div class="modal-dialog"> |
| 195 |
<div class="modal-content"> |
180 |
<div class="modal-content"> |
| 196 |
<div class="modal-header"> |
181 |
<div class="modal-header"> |
| 197 |
<h1 class="modal-title" id="helpModalLabel">Self check-in help</h1> |
182 |
<h1 class="modal-title" id="helpModalLabel">Self check-in help</h1> |
| 198 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
183 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
| 199 |
</div> |
184 |
</div> <!-- /.modal-header --> |
| 200 |
<!-- /.modal-header --> |
|
|
| 201 |
<div class="modal-body"> |
185 |
<div class="modal-body"> |
| 202 |
<ul> |
186 |
<ul> |
| 203 |
<li>Scan each item or enter its barcode. A list with the entered barcodes will be displayed.</li> |
187 |
<li>Scan each item or enter its barcode. A list with the entered barcodes will be displayed.</li> |
|
Lines 206-344
Link Here
|
| 206 |
<li>The 'Finish' button is presented to start over.</li> |
190 |
<li>The 'Finish' button is presented to start over.</li> |
| 207 |
<li>At any step, clicking the 'Cancel' button will erase the scanned barcodes and start over.</li> |
191 |
<li>At any step, clicking the 'Cancel' button will erase the scanned barcodes and start over.</li> |
| 208 |
</ul> |
192 |
</ul> |
| 209 |
</div> |
193 |
</div> <!-- /.modal-body --> |
| 210 |
<!-- /.modal-body --> |
|
|
| 211 |
<div class="modal-footer"> |
194 |
<div class="modal-footer"> |
| 212 |
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Close</button> |
195 |
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Close</button> |
| 213 |
</div> |
196 |
</div> |
| 214 |
</div> |
197 |
</div> <!-- /.modal-content --> |
| 215 |
<!-- /.modal-content --> |
198 |
</div> <!-- /.modal-dialog --> |
| 216 |
</div> |
199 |
</div> <!-- /#helpModal --> |
| 217 |
<!-- /.modal-dialog --> |
|
|
| 218 |
</div> |
| 219 |
<!-- /#helpModal --> |
| 220 |
|
200 |
|
| 221 |
</body> |
201 |
</body> |
| 222 |
|
202 |
|
| 223 |
[% INCLUDE 'opac-bottom.inc' %] |
203 |
[% INCLUDE 'opac-bottom.inc' %] |
| 224 |
[% BLOCK jsinclude %] |
204 |
[% BLOCK jsinclude %] |
|
|
205 |
[% Asset.js('js/timeout.js') | $raw %] |
| 225 |
<script> |
206 |
<script> |
|
|
207 |
|
| 226 |
function mungeHistory() { |
208 |
function mungeHistory() { |
| 227 |
// prevent back button from allowing form resubmission |
209 |
// prevent back button from allowing form resubmission |
| 228 |
if (history && history.pushState) { |
210 |
if (history && history.pushState) { |
| 229 |
history.replaceState(null, document.title, window.location.href); |
211 |
history.replaceState(null, document.title, window.location.href); |
| 230 |
} |
212 |
} |
| 231 |
} |
213 |
} |
| 232 |
|
|
|
| 233 |
function dofocus() { |
| 234 |
$(".focus:last").select(); |
| 235 |
} |
| 236 |
|
| 237 |
var barcodes = []; |
| 238 |
|
| 239 |
$( window ).on( "load", function() { |
| 240 |
dofocus(); |
| 241 |
}); |
| 242 |
|
| 243 |
$( window ).on( "unload", function() { |
| 244 |
mungeHistory(); |
| 245 |
}); |
| 246 |
|
| 247 |
$(document).ready(function() { |
| 248 |
// Barcodes scanning table initially hidden |
| 249 |
$("#sci_barcodes_table").hide(); |
| 250 |
|
| 251 |
// Control the 'append' button behaviour |
| 252 |
$("#sci_append_button").on('click', function(e) { |
| 253 |
// Make sure the form is not submitted by the button |
| 254 |
e.preventDefault(); |
| 255 |
|
| 256 |
var barcode = $('#barcode_input').val().trim(); // Trim whitespace from input |
| 257 |
|
| 258 |
if (barcode !== "") { |
| 259 |
// Properly escape the barcode value by using .text() for display |
| 260 |
var barcodeHtml = $('<tr style="font-size: initial;"><td></td></tr>'); |
| 261 |
barcodeHtml.find('td').text(barcode).append( |
| 262 |
$('<input>').attr({ |
| 263 |
type: 'hidden', |
| 264 |
name: 'barcode', |
| 265 |
value: barcode |
| 266 |
}) |
| 267 |
); |
| 268 |
|
| 269 |
$('#sci_barcodes_table tbody').append(barcodeHtml); |
| 270 |
|
| 271 |
// Make sure the table is now displayed |
| 272 |
$("#sci_barcodes_table").show(); |
| 273 |
$('#sci_checkin_button').show(); |
| 274 |
$('#sci_refresh_button').show(); |
| 275 |
|
| 276 |
// Add barcode to the array |
| 277 |
barcodes.push(barcode); |
| 278 |
} |
| 279 |
|
| 280 |
// Clear the input and reset the focus |
| 281 |
$('#barcode_input').val(''); |
| 282 |
dofocus(); |
| 283 |
}); |
| 284 |
|
214 |
|
| 285 |
$(".helpModal-trigger").on("click", function(e) { |
215 |
function dofocus() { |
| 286 |
e.preventDefault(); |
216 |
$(".focus:last").select(); |
| 287 |
$("#helpModal").modal("show"); |
217 |
} |
| 288 |
}); |
|
|
| 289 |
|
218 |
|
| 290 |
// Set focus at the beginning |
219 |
var barcodes = []; |
|
|
220 |
|
| 221 |
$( window ).on( "load", function() { |
| 291 |
dofocus(); |
222 |
dofocus(); |
| 292 |
}); |
223 |
}); |
| 293 |
|
224 |
|
| 294 |
|
225 |
$( window ).on( "unload", function() { |
| 295 |
var idleTime = 0; |
226 |
mungeHistory(); |
| 296 |
$(document).ready(function () { |
|
|
| 297 |
//Increment the idle time counter every second |
| 298 |
var idleInterval = setInterval(timerIncrement, 1000); |
| 299 |
|
| 300 |
//Zero the idle timer on mouse movement. |
| 301 |
$(this).mousemove(function (e) { |
| 302 |
idleTime = 0; |
| 303 |
}); |
| 304 |
$(this).keypress(function (e) { |
| 305 |
idleTime = 0; |
| 306 |
}); |
| 307 |
}); |
| 308 |
|
| 309 |
function timerIncrement() { |
| 310 |
if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) { |
| 311 |
idleTime = idleTime + 1; |
| 312 |
idleTimeout = [% refresh_timeout | html %]; |
| 313 |
if (idleTime >= idleTimeout ) { |
| 314 |
location.href = '/cgi-bin/koha/sci/sci-main.pl'; |
| 315 |
} |
| 316 |
} |
| 317 |
} |
| 318 |
|
| 319 |
|
| 320 |
function checkBarcodeInput() { |
| 321 |
var inputField = document.getElementById("barcode_input"); |
| 322 |
var button = document.getElementById("sci_append_button"); |
| 323 |
|
| 324 |
if (inputField.value.trim() === "") { |
| 325 |
button.disabled = true; |
| 326 |
} else { |
| 327 |
button.disabled = false; |
| 328 |
} |
| 329 |
} |
| 330 |
|
| 331 |
checkBarcodeInput(); |
| 332 |
|
| 333 |
document.getElementById("barcode_input").addEventListener("input", checkBarcodeInput); |
| 334 |
|
| 335 |
document.getElementById("sci_append_button").addEventListener("click", function() { |
| 336 |
setTimeout(checkBarcodeInput, 10); |
| 337 |
}); |
227 |
}); |
|
|
228 |
|
| 229 |
$(document).ready(function() { |
| 230 |
// Barcodes scanning table initially hidden |
| 231 |
$("#sci_barcodes_table").hide(); |
| 232 |
|
| 233 |
// Control the 'append' button behaviour |
| 234 |
$("#sci_append_button").on('click', function(e) { |
| 235 |
// Make sure the form is not submitted by the button |
| 236 |
e.preventDefault(); |
| 237 |
|
| 238 |
var barcode = $('#barcode_input').val().trim(); // Trim whitespace from input |
| 239 |
|
| 240 |
if (barcode !== "") { |
| 241 |
// Properly escape the barcode value by using .text() for display |
| 242 |
var barcodeHtml = $('<tr style="font-size: initial;"><td></td></tr>'); |
| 243 |
barcodeHtml.find('td').text(barcode).append( |
| 244 |
$('<input>').attr({ |
| 245 |
type: 'hidden', |
| 246 |
name: 'barcode', |
| 247 |
value: barcode |
| 248 |
}) |
| 249 |
); |
| 250 |
|
| 251 |
$('#sci_barcodes_table tbody').append(barcodeHtml); |
| 252 |
|
| 253 |
// Make sure the table is now displayed |
| 254 |
$("#sci_barcodes_table").show(); |
| 255 |
$('#sci_checkin_button').show(); |
| 256 |
$('#sci_refresh_button').show(); |
| 257 |
login_timeout(); |
| 258 |
|
| 259 |
// Add barcode to the array |
| 260 |
barcodes.push(barcode); |
| 261 |
} |
| 262 |
|
| 263 |
// Clear the input and reset the focus |
| 264 |
$('#barcode_input').val(''); |
| 265 |
dofocus(); |
| 266 |
}); |
| 267 |
|
| 268 |
$(".helpModal-trigger").on("click", function(e) { |
| 269 |
e.preventDefault(); |
| 270 |
$("#helpModal").modal("show"); |
| 271 |
}); |
| 272 |
|
| 273 |
// Set focus at the beginning |
| 274 |
dofocus(); |
| 275 |
}); |
| 276 |
|
| 277 |
document.addEventListener("DOMContentLoaded",function(){ |
| 278 |
if ( document.querySelector('#sci_finish_button,#sci_append_button') ){ |
| 279 |
login_timeout(); |
| 280 |
} |
| 281 |
}); |
| 282 |
function login_timeout(){ |
| 283 |
//NOTE: There can only be 1 sci_login_timer at a time |
| 284 |
if ( ! window.sci_login_timer ){ |
| 285 |
const idleTimeout = "[% Koha.Preference('SelfCheckInTimeOut') || 120 | html %]"; |
| 286 |
const home_href = "/cgi-bin/koha/sci/sci-main.pl"; |
| 287 |
const sci_timer = new sc_timer({ |
| 288 |
"idle_timeout": idleTimeout, |
| 289 |
"redirect_url": home_href |
| 290 |
}); |
| 291 |
window.sci_login_timer = sci_timer; |
| 292 |
sci_timer.start_timer(); |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
function checkBarcodeInput() { |
| 297 |
var inputField = document.getElementById("barcode_input"); |
| 298 |
var button = document.getElementById("sci_append_button"); |
| 299 |
|
| 300 |
if (inputField.value.trim() === "") { |
| 301 |
button.disabled = true; |
| 302 |
} else { |
| 303 |
button.disabled = false; |
| 304 |
} |
| 305 |
} |
| 306 |
|
| 307 |
checkBarcodeInput(); |
| 308 |
|
| 309 |
document.getElementById("barcode_input").addEventListener("input", checkBarcodeInput); |
| 310 |
|
| 311 |
document.getElementById("sci_append_button").addEventListener("click", function() { |
| 312 |
setTimeout(checkBarcodeInput, 10); |
| 313 |
}); |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 338 |
</script> |
321 |
</script> |
|
|
322 |
|
| 339 |
[% IF ( Koha.Preference('SelfCheckInUserJS') ) %] |
323 |
[% IF ( Koha.Preference('SelfCheckInUserJS') ) %] |
| 340 |
<script> |
324 |
<script>[% Koha.Preference('SelfCheckInUserJS') | $raw %]</script> |
| 341 |
[% Koha.Preference('SelfCheckInUserJS') | $raw %] |
|
|
| 342 |
</script> |
| 343 |
[% END %] |
325 |
[% END %] |
| 344 |
[% END %] |
326 |
[% END %] |