diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index 812f85e9..f15475a1 100755
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -474,7 +474,9 @@
<% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
-
+ <%if !@order_items.empty? %>
+
+ <% end %>
@@ -482,7 +484,7 @@
<% if !@split_bill.nil? %>
- <% if @split_bill == '1' %>
+ <% if @split_bill == '1' && (!@order_items.empty?) %>
<% end %>
<% end %>
@@ -513,7 +515,7 @@
<% if !@split_bill.nil? %>
- <% if @split_bill == '1' %>
+ <% if @split_bill == '1' && (!@order_items.empty?) %>
<% end %>
<% end %>
@@ -1049,25 +1051,28 @@
// Bill Request
$('#request_bills').click(function () {
- if($('#request_bills').is(":visible")) {
- $('#request_bills').prop("disabled",true);
- }
-
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
- $.ajax({
- type: "GET",
- url: ajax_url,
- // data: 'order_id='+ order_id,
- success: function (result) {
- if (!result.status) {
- swal("Information!", result.error_message);
- }
- else {
- location.reload();
- }
- }
- });
+ if(order_id!=undefined && order_id!=null && order_id!=""){
+ if($('#request_bills').is(":visible")) {
+ $('#request_bills').prop("disabled",true);
+ }
+ $.ajax({
+ type: "GET",
+ url: ajax_url,
+ // data: 'order_id='+ order_id,
+ success: function (result) {
+ if (!result.status) {
+ swal("Information!", result.error_message);
+ }
+ else {
+ location.reload();
+ }
+ }
+ });
+ }else{
+ swal("Opps","There is no orders!","warning");
+ }
});
//split bill process
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index f27ba647..83e75023 100755
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -506,12 +506,14 @@
-
+ <% if !@order_items.empty? %>
+
+ <% end %>
<% if !@split_bill.nil? %>
- <% if @split_bill == '1' %>
+ <% if @split_bill == '1' && (!@order_items.empty?) %>
<% end %>
<% end %>
@@ -538,7 +540,7 @@
<% if !@split_bill.nil? %>
- <% if @split_bill == '1' %>
+ <% if @split_bill == '1' && (!@order_items.empty?) %>
<% end %>
<% end %>
@@ -1027,24 +1029,29 @@ $('#pay').on('click',function() {
});
// Bill Request
$('#request_bills').click(function() {
- if($('#request_bills').is(":visible")) {
- $('#request_bills').prop("disabled",true);
- }
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
- $.ajax({
- type: "GET",
- url: ajax_url,
- // data: 'order_id='+ order_id,
- success: function (result) {
- if (!result.status) {
- swal("Information!", result.error_message);
- }
- else {
- location.reload();
- }
- }
- });
+ if(order_id!=undefined && order_id!=null && order_id!=""){
+ if($('#request_bills').is(":visible")) {
+ $('#request_bills').prop("disabled",true);
+ }
+ $.ajax({
+ type: "GET",
+ url: ajax_url,
+ // data: 'order_id='+ order_id,
+ success: function (result) {
+ if (!result.status) {
+ swal("Information!", result.error_message);
+ }
+ else {
+ location.reload();
+ }
+ }
+ });
+ }else{
+ swal("Opps","There is no orders!","warning");
+ }
+
});
//split bill process
@@ -1215,7 +1222,7 @@ $('#add_invoice').on('click',function(){
}
});
}else{
- swal("Opps","You are not authorized for void","warning")
+ swal("Opps","You are not authorized for void","warning");
}
});