add booking

This commit is contained in:
phyusin
2018-02-05 11:05:58 +06:30
parent 991bc48505
commit 8fed8d701a
2 changed files with 13 additions and 5 deletions

View File

@@ -49,10 +49,15 @@ class Origami::SplitBillController < BaseOrigamiController
end
end
else
puts "new booking"
puts "new order"
puts "update order_id in order"
puts "do process"
if params[:type] == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc, :checkin_by => current_user.name,
:booking_status => "assign" })
end
# Bind shift sale id to sale

View File

@@ -15,6 +15,7 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<span class="hidden" id ="table_id" value="<%=@table.id%>"><%=@table.id%></span>
<span class="hidden" id="table_type" value="<%=@table.type%>"><%=@table.type%></span>
<span class="hidden" id="customer_id" value="<%= @order.customer_id %>"><%= @order.customer_id %></span>
<p class="m-l-10">Order No: <span id="order_no"><%=@order.order_id rescue ' '%></span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
@@ -167,6 +168,8 @@
/* function for split bill process */
function splitBillProcess(cnt_items){
var dining_id = $("#table_id").text();
var type = $("#table_type").text();
var order_items = get_selected_order_items();// Selected Order Items
var json_booking = JSON.parse('<%= @booking.to_json.html_safe %>');
var booking_id = "";
@@ -179,7 +182,7 @@ function splitBillProcess(cnt_items){
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)},
data: {'dining_id' : dining_id, 'type': type, 'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);