diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index 7319d829..00d8e2cf 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -15,8 +15,11 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' var active_class = ""; if(key==0){ active_class = "tr-active"; - if (typeof showNewOrder !== 'undefined' && $.isFunction(showNewOrder)) { - showNewOrder(order[key],shop_code); + if (typeof audioPlayBackground !== 'undefined' && $.isFunction(audioPlayBackground)) { + audioPlayBackground(shop_code); + } + if (typeof showNewOrderAlert !== 'undefined' && $.isFunction(showNewOrderAlert)) { + showNewOrderAlert(order[key],shop_code); } } var rowCount = key+1; diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 8da818df..7477ffd3 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -160,6 +160,7 @@ $(document).ready(function() { /* start order reservation function */ function audioPlayBackground(shop_code){ + console.log(shop_code); //audio play var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio // setTimeout(function(){ diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 7df285bc..95f7ea29 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -484,13 +484,12 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas }); } -function showNewOrder(order_reservation,shop_code){ +function showNewOrderAlert(order_reservation,shop_code){ if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){ var date = new Date(order_reservation.requested_time); var time = timeFormat(date); var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time; $('.first-1').click(); - audioPlayBackground(shop_code); swal({ title: 'Information',