App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChannel', { // App.messages = App.cable.subscriptions.create('MessagesChannel', { connected: function() {}, disconnected: function() {}, received: function(data) { var hostname = location.hostname.trim(); if(data.from == "" || hostname == data.from){ var oqs_id = $('.oqs_active').attr('data-id'); items = data.order; for(var field in items) { var price = parseFloat(items[field].price).toFixed(2); if (items[field]["options"] == "[]" || items[field]["options"] == "") { var options = ""; }else{ var options = items[field]["options"]; } //for count test = document.getElementsByClassName("oqs_count"); for (var i = 0; i < test.length; i++) { oqs_count_id = $(".oqs_count"+i).attr("data-id"); oqs_count = $(".oqs_count"+i).text(); if ( oqs_count_id == items[field]["order_queue_station_id"]) { oqs_count_total = +oqs_count +1 ; $(".oqs_count"+i).text(oqs_count_total) } } //end count var date = new Date(items[field]["created_at"]); // var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM'); if (oqs_id == items[field]["order_queue_station_id"]) { var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:""; var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table"; (name === 'true') ? 'Y' :'N'; row ='
' +''+ items[field]["item_name"] +'- ' +' [x'+ items[field]["qty"] +'] ' +'
' +''+ items[field]["customer_name"] +'
' +''+ items[field]["assigned_order_item_id"] +'
' +'