App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { connected: function() {}, disconnected: function() {}, received: function(data) { var order = data.data; var shop_code = data.shop_code; 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({ // title: 'Information', // target: document.getElementById(shop_code+"_notify_new_order"), // text: "You have new orders
"+ // "Are you accept or reject for these orders "+order_lists+"?", // type: 'success', // html: true, // closeOnConfirm: false, // closeOnCancel: false, // allowOutsideClick: false // }, function (isConfirm) { // if(isConfirm){ // swal.close(); // } // }); $("#notify_new_order_lists").text(order_lists); // if($("#notify_new_order").hasClass("hidden")){ $("#notify_new_order").removeClass("hidden"); // } $("#notify_new_order").on('shown.bs.modal', function(e){ $(document).off('focusin.modal'); $("#notify_new_order").focus(); $("#"+shop_code+"_doemal_new_order").addClass("hidden"); $("#notify_order_send_to_kitchen").addClass("hidden"); $("#notify_order_ready_to_delivery").addClass("hidden"); }).on('hide.bs.modal', function (e) { $("#notify_new_order").addClass("hidden"); }).modal({show: true, keyboard: false, backdrop: false}); } } });