diff --git a/minigrid/static/src/js/minigrid_write_credit.js b/minigrid/static/src/js/minigrid_write_card.js similarity index 63% rename from minigrid/static/src/js/minigrid_write_credit.js rename to minigrid/static/src/js/minigrid_write_card.js index 9706984..c9a5e44 100644 --- a/minigrid/static/src/js/minigrid_write_credit.js +++ b/minigrid/static/src/js/minigrid_write_card.js @@ -7,7 +7,9 @@ import populateCardInfoTable from './populate_card_info.js'; (function(){ - const input = document.getElementById('card-value'); + const inputs = document.getElementsByClassName('card-value'); + + console.log('new input', inputs) let conn = new SockJS(http_protocol + '://' + window.location.host + '/cardconn'); let received_info; @@ -21,14 +23,19 @@ import populateCardInfoTable from './populate_card_info.js'; }; conn.onmessage = function(e) { - console.log('Received: ' + JSON.stringify(e.data['received_info'])); + console.log('Received!: ' + JSON.stringify(e.data)); received_info = e.data['received_info']; card_read_error = e.data['card_read_error']; + console.log('its different part 1', e.data['device_active']); if (e.data['device_active']!==device_active) { device_active = e.data['device_active']; - if (e.data['device_active']) input.disabled = false; - else input.disabled = true; + console.log('its different', device_active); + console.log(inputs); + [].forEach.call(inputs, function(input){ + if (e.data['device_active']) input.disabled = false; + else input.disabled = true; + }); populateCardInfoTable(received_info, card_read_error); }; }; diff --git a/minigrid/templates/minigrid_customers.html b/minigrid/templates/minigrid_customers.html index ff72282..f932c30 100644 --- a/minigrid/templates/minigrid_customers.html +++ b/minigrid/templates/minigrid_customers.html @@ -22,13 +22,13 @@
User ID: {{ customer.customer_user_id }}
@@ -36,6 +36,6 @@