App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { connected: function() {}, disconnected: function() {}, received: function(data) { var order = data.data; if(order.length > 0){ var order_lists = ""; $.each(order, function(key, value){ if(key==0){ order_lists = value.order_reservation_id; }else if(key == (order.length - 1)){ order_lists += ' and ' + value.order_reservation_id; }else{ order_lists += ', ' + value.order_reservation_id; } }); // alert(order_lists); swal({ html: true, title: 'Information', target: document.getElementById('notify_new_order'), text: "You have new orders.
"+ "Are you accept or reject for these orders "+order_lists+"?", type: 'success', timer: 1000, closeOnConfirm: false, closeOnCancel: false, allowOutsideClick: false },function(isConfirm){ if(isConfirm){ swal.close(); } }); } } });