Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2018-07-20 09:42:54 +06:30
4 changed files with 54 additions and 41 deletions

View File

@@ -33,6 +33,7 @@ class Origami::HomeController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ") @dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
#@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'") #@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
@order_items = Array.new
@dining_booking.each do |booking| @dining_booking.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new

View File

@@ -33,6 +33,7 @@ class Origami::RoomsController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@dining_room = @room.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ") @dining_room = @room.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
@order_items = Array.new
@dining_room.each do |booking| @dining_room.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new
@@ -100,7 +101,6 @@ class Origami::RoomsController < BaseOrigamiController
end end
end end
end end
# @room.bookings.each do |booking| # @room.bookings.each do |booking|
# if booking.sale_id.nil? # if booking.sale_id.nil?
# @order_items = Array.new # @order_items = Array.new

View File

@@ -474,7 +474,9 @@
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button> <button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %> <% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<%if !@order_items.empty? %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button> <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% end %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled>Edit</button> --> <!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled>Edit</button> -->
<!-- <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" disabled>Discount</button> --> <!-- <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" disabled>Discount</button> -->
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> --> <!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
@@ -482,7 +484,7 @@
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button> <button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %> <% end %>
<% end %> <% end %>
@@ -513,7 +515,7 @@
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button> <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %> <% end %>
<% end %> <% end %>
@@ -1049,12 +1051,12 @@
// Bill Request // Bill Request
$('#request_bills').click(function () { $('#request_bills').click(function () {
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bills').is(":visible")) { if($('#request_bills').is(":visible")) {
$('#request_bills').prop("disabled",true); $('#request_bills').prop("disabled",true);
} }
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
@@ -1068,6 +1070,9 @@
} }
} }
}); });
}else{
swal("Opps","There is no orders!","warning");
}
}); });
//split bill process //split bill process

View File

@@ -506,12 +506,14 @@
<!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> --> <!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> -->
<!-- <button type="button" id="discount" class="btn bg-blue btn-block" disabled >Discount</button> --> <!-- <button type="button" id="discount" class="btn bg-blue btn-block" disabled >Discount</button> -->
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> --> <!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
<% if !@order_items.empty? %>
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button> <button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
<% end %>
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button> <button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button> <button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %> <% end %>
<% end %> <% end %>
@@ -538,7 +540,7 @@
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button> <button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %> <% end %>
<% end %> <% end %>
@@ -1027,11 +1029,12 @@ $('#pay').on('click',function() {
}); });
// Bill Request // Bill Request
$('#request_bills').click(function() { $('#request_bills').click(function() {
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bills').is(":visible")) { if($('#request_bills').is(":visible")) {
$('#request_bills').prop("disabled",true); $('#request_bills').prop("disabled",true);
} }
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
@@ -1045,6 +1048,10 @@ $('#request_bills').click(function() {
} }
} }
}); });
}else{
swal("Opps","There is no orders!","warning");
}
}); });
//split bill process //split bill process
@@ -1215,7 +1222,7 @@ $('#add_invoice').on('click',function(){
} }
}); });
}else{ }else{
swal("Opps","You are not authorized for void","warning") swal("Opps","You are not authorized for void","warning");
} }
}); });