color book items according to circulation stataus
[Biblio-RFID.git] / examples / selfcheck.js
index 9436d79..189bfa5 100644 (file)
@@ -61,7 +61,8 @@ function change_page(new_state) {
 
                if ( state == 'error' ) {
                        window.setTimeout(function(){
-                               change_page('start');
+                               //change_page('start');
+                               location.reload();
                        },error_timeout);
                }
        }
@@ -193,7 +194,11 @@ function circulation( barcode, sid ) {
                pending_jsonp++;
                $.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>');
+
+                       var color = 'red';
+                       if ( data['fixed'].substr(2,1) == 1 ) color='green';
+
+                       $('ul#books').append('<li style="color:'+color+'">' + ( data['AJ'] || barcode ) + ( data['AF'] ? ' <b>' + data['AF'] + '</b>' : '' ) + '</li>');
                        $('#books_count').html( $('ul#books > li').length );
                        console.debug( book_barcodes );
                        pending_jsonp--;