update books_count after list
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 28 Aug 2014 12:46:24 +0000 (14:46 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 28 Aug 2014 12:46:24 +0000 (14:46 +0200)
examples/selfcheck.html
examples/selfcheck.js

index dab4ef4..6b26462 100644 (file)
@@ -114,7 +114,7 @@ Postavite knjige na predviđeno mjesto ispred monitora.
 <ul id="books">
 </ul>
 
-Dokumenata: 0
+Dokumenata: <span id="books_count">0</span>
 
 <div style="display: block">
 <input type="button" value="Završi" onClick="change_page('end')">
index d2f82b5..4955e54 100644 (file)
@@ -48,6 +48,7 @@ function change_page(new_state) {
                        circulation_type = 'checkout';
                        book_barcodes = {};
                        $('ul#books').html(''); // clear book list
+                       $('#books_count').html( 0 );
                        scan_tags();
                }
 
@@ -190,6 +191,7 @@ function circulation( barcode, sid ) {
                $.getJSON('/sip2/'+circulation_type+'/'+borrower_cardnumber+'/'+barcode+'/'+sid , function( data ) {
                        console.info( circulation_type, data );
                        $('ul#books').append('<li>' + ( data['AJ'] || barcode ) + ( data['AF'] ? ' <b>' + data['AF'] + '</b>' : '' ) + '</li>');
+                       $('#books_count').html( $('ul#books > li').length );
                        console.debug( book_barcodes );
                        pending_jsonp--;
                }).fail( function() {