diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index e1c67b76..1d7dfa97 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -76,6 +76,11 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' if (typeof customTableClick !== 'undefined' && $.isFunction(customTableClick)) { customTableClick(); } + + if(parseInt(getOnlineOrderCount()) > 0){ + $('.order_no').addClass("order-badge"); + $('.order_no').html(parseInt(getOnlineOrderCount())); + } } } }); diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 005d6c6a..02024651 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -176,4 +176,25 @@ function audioPlayBackground(shop_code,audio){ audio.play(); // },10000); } -/* end order reservation function */ \ No newline at end of file +/* end order reservation function */ + +/* online order count*/ +function getOnlineOrderCount(){ + var count = 0; + //Start Ajax + $.ajax({ + async: false, + type: "GET", + url: "/origami/get_order_info", + dataType: "json", + success: function(data){ + if(parseInt(data) > 0){ + count = parseInt(data); + } + } + }); + //end Ajax + // alert(count); + return count; +} +/* online order count*/ \ No newline at end of file diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 46d035fe..d1ed693e 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -20,6 +20,7 @@ $(function() { $('#cancel').hide(); $(".tbl_customer").hide(); $(".order_close_cashier").hide(); + $(".order_btns").show(); refreshDetailData(); if (type == "pending") { $(".first-1").click(); @@ -41,6 +42,7 @@ $(function() { }else if(type == "processed"){ $(".fifth-1").click(); $(".order_close_cashier").show(); + $(".order_btns").hide(); // $('#accepted').hide(); // $('#cancel').hide(); } @@ -501,6 +503,10 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas // } // } // }); + if(parseInt(getOnlineOrderCount()) > 0){ + $('.order_no').addClass("order-badge"); + $('.order_no').html(parseInt(getOnlineOrderCount())); + } } function showNewOrderAlert(order_reservation,shop_code){ @@ -601,4 +607,25 @@ function timeFormat(date){ (isPM ? ' PM' : ' AM'); return time; } -/* end order reservation function */ \ No newline at end of file +/* end order reservation function */ + +/* online order count*/ +function getOnlineOrderCount(){ + var count = 0; + //Start Ajax + $.ajax({ + async: false, + type: "GET", + url: "/origami/get_order_info", + dataType: "json", + success: function(data){ + if(parseInt(data) > 0){ + count = parseInt(data); + } + } + }); + //end Ajax + // alert(count); + return count; +} +/* online order count*/ \ No newline at end of file diff --git a/app/assets/stylesheets/order_reservation.scss b/app/assets/stylesheets/order_reservation.scss index 4a5c591a..e46ce76d 100644 --- a/app/assets/stylesheets/order_reservation.scss +++ b/app/assets/stylesheets/order_reservation.scss @@ -54,6 +54,7 @@ .custom-card-footer .table td:first-child, .custom-card-footer .table td:nth-child(2){ border-top:0px solid !important; + height: 20px; } .custom-card-footer .footer-td , @@ -62,13 +63,16 @@ border-bottom:0px solid !important; font-weight: bold; padding:6px 10px; + height: 64px; } .custom-card-header{ border-bottom: 1px solid #F8BBD0 !important; padding:13px 5px !important; + height: 50px; } .custom-card-footer{ border-top: 1px solid #F8BBD0 !important; + border-bottom: 1px solid #FAFAFA !important; } .custom-card-block, .grand-card-footer, @@ -87,8 +91,12 @@ background-color : #FFCDD2; } .div_order_margin { - margin: 0px 0px 0px -5px !important + margin: -4px 0px 0px -5px !important } .div_card_order { margin: 0px -5px !important +} +td.grand-total-padding { + font-size: 17px; + padding-top: 20px !important; } \ No newline at end of file diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css index 78f23e15..1326a293 100644 --- a/app/assets/stylesheets/reset.css +++ b/app/assets/stylesheets/reset.css @@ -283,4 +283,41 @@ section.content { padding: 0.5rem 0.44rem; } /* End Reset Theme */ + +/* shop name margin */ +.shop-name-margin { + margin-left : 20%; +} +/* shop name margin */ + +/* online order margin */ +.online-order-margin { + margin-left : 22%; + margin-bottom : 9.9999px; +} +/* online order margin */ +/* default-header-color */ +div.online-order-margin > div > span { + color : #FAFAFA; +} +/* default-header-color */ +/* order-no color */ +.order-badge { + position: absolute; + background: #ff6600; + height: 1.8rem; + bottom: -0.1rem; + right: -1.3rem; + width: 1.8rem; + text-align: center; + line-height: 1.7rem; + font-size: 0.9rem; + border-radius: 50%; + color: white; + border: 1px solid #ff6600; + font-family: sans-serif; + font-weight: bold; +} +/* order-no color */ + /* *************************************************** */ \ No newline at end of file diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index fcfdcbb4..f4f993d5 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -96,4 +96,9 @@ class Origami::OrderReservationController < BaseOrigamiController render :json => response end + def get_order_info + order_reservation = OrderReservation.where("status = 'new' OR status='accepted' OR status='send_to_kitchen' OR status = 'ready_to_delivery'").count() + render :json => order_reservation + end + end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d21b1743..c8cec5ea 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -36,12 +36,22 @@ -