View | Details | Raw Unified | Return to bug 37861
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt (-30 / +44 lines)
Lines 226-262 Link Here
226
        });
226
        });
227
227
228
        $(document).ready(function() {
228
        $(document).ready(function() {
229
            // Barcodes scanning table initially hidden
229
    // Barcodes scanning table initially hidden
230
            $("#sci_barcodes_table").hide();
230
    $("#sci_barcodes_table").hide();
231
            // Control de 'append' button behaviour
231
    
232
            $("#sci_append_button").on('click',function( e ){
232
    // Control the 'append' button behaviour
233
                // Make sure the form is not submitted by the button
233
    $("#sci_append_button").on('click', function(e) {
234
                e.preventDefault();
234
        // Make sure the form is not submitted by the button
235
                var barcode = $('#barcode_input').val();
235
        e.preventDefault();
236
                //var result  = validate_barcode( barcode );
236
        
237
                $('#sci_barcodes_table tbody').append(
237
        var barcode = $('#barcode_input').val().trim(); // Trim whitespace from input
238
                        '<tr style="font-size: initial;"><td>' +
238
        
239
                            barcode +
239
        if (barcode !== "") {
240
                            '<input type="hidden" name="barcode" value="' + barcode + '" />' +
240
            // Properly escape the barcode value by using .text() for display
241
                        '</td></tr>' );
241
            var barcodeHtml = $('<tr style="font-size: initial;"><td></td></tr>');
242
                // Make sure the table is now displayed
242
            barcodeHtml.find('td').text(barcode).append(
243
                $("#sci_barcodes_table").show();
243
                $('<input>').attr({
244
                $('#sci_checkin_button').show();
244
                    type: 'hidden',
245
                $('#sci_refresh_button').show();
245
                    name: 'barcode',
246
                barcodes.push(barcode);
246
                    value: barcode
247
                // clean the input, reset the focus
247
                })
248
                $('#barcode_input').val('');
248
            );
249
                dofocus();
249
            
250
            });
250
            $('#sci_barcodes_table tbody').append(barcodeHtml);
251
            
252
            // Make sure the table is now displayed
253
            $("#sci_barcodes_table").show();
254
            $('#sci_checkin_button').show();
255
            $('#sci_refresh_button').show();
256
            
257
            // Add barcode to the array
258
            barcodes.push(barcode);
259
        }
260
        
261
        // Clear the input and reset the focus
262
        $('#barcode_input').val('');
263
        dofocus();
264
    });
251
265
252
            $(".helpModal-trigger").on("click",function(e){
266
    $(".helpModal-trigger").on("click", function(e) {
253
                e.preventDefault();
267
        e.preventDefault();
254
                $("#helpModal").modal("show");
268
        $("#helpModal").modal("show");
255
            });
269
    });
270
271
    // Set focus at the beginning
272
    dofocus();
273
});
256
274
257
            // set focus at the beginning
258
            dofocus();
259
        });
260
275
261
        var idleTime = 0;
276
        var idleTime = 0;
262
        $(document).ready(function () {
277
        $(document).ready(function () {
263
- 

Return to bug 37861