Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
if (@booking)
|
||||
json.success true
|
||||
json.id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
if Sale.exists?(@booking.sale_id)
|
||||
@@ -43,5 +44,6 @@ if (@booking)
|
||||
json.sub_total @total_amount
|
||||
json.commerical_tax @total_amount * 0.05
|
||||
json.total @total_amount + (@total_amount * 0.05)
|
||||
|
||||
else
|
||||
json.success false
|
||||
end
|
||||
|
||||
49
app/views/api/orders/view_orders.json.jbuilder
Normal file
49
app/views/api/orders/view_orders.json.jbuilder
Normal file
@@ -0,0 +1,49 @@
|
||||
if (@booking)
|
||||
json.success true
|
||||
json.booking_id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
if Sale.exists?(@booking.sale_id)
|
||||
json.sale_status Sale.find(@booking.sale_id).sale_status
|
||||
else
|
||||
json.sale_status ""
|
||||
end
|
||||
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||
json.checkin_by @booking.checkin_by
|
||||
json.table_name @booking.dining_facility.name
|
||||
|
||||
if @booking.type == "TableBooking"
|
||||
json.table_id @booking.dining_facility_id
|
||||
else
|
||||
json.room_id @booking.dining_facility_id
|
||||
end
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
#if (order.status == "new")
|
||||
order_items = order_items + order.order_items
|
||||
#end
|
||||
end
|
||||
|
||||
json.order_items order_items do |item|
|
||||
json.item_instance_code item.item_code
|
||||
json.item_name item.item_name
|
||||
json.price item.price
|
||||
json.qty item.qty
|
||||
json.options item.options
|
||||
json.remark item.remark
|
||||
json.item_status item.order_item_status
|
||||
@total_amount = @total_amount + (item.price * item.qty)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
json.sub_total @total_amount
|
||||
json.commerical_tax @total_amount * 0.05
|
||||
json.total @total_amount + (@total_amount * 0.05)
|
||||
else
|
||||
json.success false
|
||||
end
|
||||
@@ -8,7 +8,7 @@ if @zones
|
||||
json.name table.name
|
||||
json.status table.status
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking table.get_current_booking
|
||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||
end
|
||||
|
||||
json.rooms zone.rooms do |room|
|
||||
@@ -16,7 +16,7 @@ if @zones
|
||||
json.name room.name
|
||||
json.status room.status
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking room.get_current_booking
|
||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||
|
||||
end
|
||||
end
|
||||
@@ -26,7 +26,7 @@ else #list all tables and rooms with out zones
|
||||
json.name table.name
|
||||
json.status table.status
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking table.get_current_booking
|
||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ else #list all tables and rooms with out zones
|
||||
json.name room.name
|
||||
json.status room.status
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking room.get_current_booking
|
||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user